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
expectedContentstringThe string that is expected to be found in the response body.
optionsTextOptionsOptional 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
contentTypestringThe content-type value to validate.
optionsTextOptionsOptional 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
namestringThe name of the HTTP header to validate.
optionsTextOptionsOptional 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
namestringThe name of the HTTP header to validate.
valuestringThe value of the HTTP header to validate.
optionsTextOptionsOptional 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
maxDurationTimeSpanThe 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
statusCodeHttpStatusCodeThe 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.