Skip to content

Commit

Permalink
adding a section to the README file with a brief overview of the supp…
Browse files Browse the repository at this point in the history
…orted assertions
  • Loading branch information
Eric Rutherford committed Jun 10, 2020
1 parent 5d39e5a commit 77b0111
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,28 @@ See [Releases](https://github.com/maxcnunes/httpfake/releases) for detailed hist

See [godoc reference](https://godoc.org/github.com/maxcnunes/httpfake) for detailed API documentation.

## Assertions

There are built-in methods you can use to make assertions about requests to your HTTP handlers. The currently
supported assertions are:

* Presence of query parameters
* Query parameter and its expected value
* Presence of HTTP headers
* HTTP header and its expected value
* The expected body of your request

[WithTesting](https://godoc.org/github.com/maxcnunes/httpfake#WithTesting) **must** be provided as a server
option when creating the test server if intend to set request assertions. Failing to set the option
when using request assertions will result in a panic.

### Custom Assertions

You can also provide your own request assertions by creating a type that implements the
[Assertor interface](https://godoc.org/github.com/maxcnunes/httpfake#Assertor). The `Assertor.Log` method will be
called for each assertion before it's processed. The `Assertor.Error` method will only be called if the
`Assertor.Assert` method returns an error.

## Examples

For a full list of examples please check out the [functional_tests folder](/functional_tests).
Expand Down

0 comments on commit 77b0111

Please sign in to comment.