🃏
Bard
  • Introduction
  • Getting Started
    • Installation
    • Writing Your First Test
    • Configuration
    • .NET Fiddles
  • Anatomy Of A Scenario
    • Given
      • StoryData
      • StoryBook
      • Chapter
      • Story
    • When
    • Then
      • HTTP Response
      • Headers
      • Bad Requests
      • Performance Testing
  • Advanced
    • Dependency Injection
  • Miscellaneous
    • Change Log
    • Migration Guide
  • gRPC
    • Installation
    • Configuration
    • Writing A Test
  • Tips & Tricks
    • FAQ
Powered by GitBook
On this page
  • HTTP Response Assertion

Was this helpful?

Export as PDF
  1. Anatomy Of A Scenario
  2. Then

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

 Then
     .Response
     .ShouldBe
     .Ok();
 
 // OR
 
 Then
     .Response
     .ShouldBe
     .Forbidden();

If you need to Assert another HTTP code was returned then you can specify the HTTP code as well.

 Then
     .Response
     .ShouldBe
     .StatusCodeShouldBe(HttpStatusCode.Ambiguous);

PreviousThenNextHeaders

Last updated 4 years ago

Was this helpful?