Table of Contents

Interface IHttpAssertions

Namespace
Xping.Sdk.Validations.HttpResponse
Assembly
Xping.Sdk.dll

Represents an object for validating an HTTP response.

public interface IHttpAssertions

Methods

ToHaveBodyContaining(string, TextOptions?)

Validates that the response body contains a specific string.

IHttpAssertions ToHaveBodyContaining(string expectedContent, TextOptions? options = null)

Parameters

expectedContent string

The string that is expected to be found in the response body.

options TextOptions

Optional parameter for customizing the search text behavior.

Returns

IHttpAssertions

An instance of IHttpAssertions to allow for further assertions.

ToHaveContentType(string, TextOptions?)

Validates the Content-Type header of the HTTP response.

IHttpAssertions ToHaveContentType(string contentType, TextOptions? options = null)

Parameters

contentType string

The content-type value to validate.

options TextOptions

Optional parameter for customizing the search text behavior.

Returns

IHttpAssertions

An instance of IHttpAssertions to allow for further assertions.

ToHaveHeader(string, TextOptions?)

Validates that the HTTP response contains a specific header.

IHttpAssertions ToHaveHeader(string name, TextOptions? options = null)

Parameters

name string

The name of the HTTP header to validate.

options TextOptions

Optional parameter for customizing the search text behavior.

Returns

IHttpAssertions

An instance of IHttpAssertions to allow for further assertions.

ToHaveHeaderWithValue(string, string, TextOptions?)

Validates that the HTTP response contains a specific header with value.

IHttpAssertions ToHaveHeaderWithValue(string name, string value, TextOptions? options = null)

Parameters

name string

The name of the HTTP header to validate.

value string

The value of the HTTP header to validate.

options TextOptions

Optional parameter for customizing the search text behavior.

Returns

IHttpAssertions

An instance of IHttpAssertions to allow for further assertions.

ToHaveResponseTimeLessThan(TimeSpan)

Validates that the response time is less than a specified duration.

IHttpAssertions ToHaveResponseTimeLessThan(TimeSpan maxDuration)

Parameters

maxDuration TimeSpan

The maximum allowable duration for the response time.

Returns

IHttpAssertions

An instance of IHttpAssertions to allow for further assertions.

ToHaveStatusCode(HttpStatusCode)

Validates that the HTTP response has the specified status code.

IHttpAssertions ToHaveStatusCode(HttpStatusCode statusCode)

Parameters

statusCode HttpStatusCode

The expected status code.

Returns

IHttpAssertions

An instance of IHttpAssertions to allow for further assertions.

ToHaveSuccessStatusCode()

Ensures that the HTTP response has a successful (2xx) status code.

IHttpAssertions ToHaveSuccessStatusCode()

Returns

IHttpAssertions

An instance of IHttpAssertions to allow for further assertions.