HTTP Response

HTTP Response Assertion

Bard natively supports out of the box the following HTTP responses
    HTTP 200 OK
    HTTP 201 Created
    HTTP 204 No Content
    HTTP 403 Forbidden
    HTTP 404 Not Found
1
Then
2
.Response
3
.ShouldBe
4
.Ok();
5
6
// OR
7
8
Then
9
.Response
10
.ShouldBe
11
.Forbidden();
Copied!
If you need to Assert another HTTP code was returned then you can specify the HTTP code as well.
1
Then
2
.Response
3
.ShouldBe
4
.StatusCodeShouldBe(HttpStatusCode.Ambiguous);
Copied!

​

Last modified 1yr ago
Export as PDF
Copy link