Table of Contents

Class HttpHealthCheck

Namespace
C4.Net
Assembly
C4.Net.Core.dll

Represents a HTTP-based health check.

[DataContract]
public sealed class HttpHealthCheck : IEquatable<HttpHealthCheck>
Inheritance
HttpHealthCheck
Implements
Inherited Members

Properties

Headers

The headers that should be sent in the HTTP request.

[DataMember(Name = "headers", EmitDefaultValue = true)]
public Dictionary<string, string> Headers { get; }

Property Value

Dictionary<string, string>

Interval

The polling interval, in seconds.

[DataMember(Name = "interval", EmitDefaultValue = true)]
public int Interval { get; }

Property Value

int

Name

A name for the health check.

[DataMember(Name = "name", EmitDefaultValue = true)]
public string Name { get; }

Property Value

string

Timeout

The timeout after which a health check is deemed as failed, in milliseconds.

[DataMember(Name = "timeout", EmitDefaultValue = true)]
public long Timeout { get; }

Property Value

long

Url

The health check URL/endpoint.

[DataMember(Name = "url", EmitDefaultValue = true)]
public string Url { get; }

Property Value

string

Methods

AddHeader(string, string)

Adds a HTTP header, which will be sent with the HTTP request to the health check URL.

public void AddHeader(string name, string value)

Parameters

name string

The name of the header.

value string

The header value.

Exceptions

ArgumentException

Thrown when name is null or empty, or when value is null.

Equals(HttpHealthCheck)

Compares this health check with another by URL.

public bool Equals(HttpHealthCheck other)

Parameters

other HttpHealthCheck

The health check to compare with.

Returns

bool

true when both health checks target the same URL; otherwise, false.

Equals(object)

Compares this instance with another object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with.

Returns

bool

true when obj is a matching HttpHealthCheck; otherwise, false.

GetHashCode()

Returns a hash code derived from the health check URL.

public override int GetHashCode()

Returns

int

A hash code for the current health check.