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
stringThe string that is expected to be found in the response body.
options
TextOptionsOptional 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
stringThe content-type value to validate.
options
TextOptionsOptional 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
stringThe name of the HTTP header to validate.
options
TextOptionsOptional 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
stringThe name of the HTTP header to validate.
value
stringThe value of the HTTP header to validate.
options
TextOptionsOptional 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
TimeSpanThe 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
HttpStatusCodeThe 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.