Logo: Relish

  1. Sign in

Project: Gavel 3.0.0

Gavel 3.0.0

Behavior spec for Gavel, validator of HTTP transactions

GitHub repository npm version

Gavel - Validator of HTTP Transactions

What is Gavel?

Gavel detects important differences between actual and expected HTTP transactions (HTTP request and response pairs). Gavel also decides whether the actual HTTP transaction is valid or not.


  • Expected HTTP request and corresponding response
  • Actual HTTP request and corresponding response


  • Validation verdict (boolean) or validation result (complex information about what's different)

Gavel is useful specifically in testing HTTP APIs. It enables specification by example and BDD approach. The most prominent project built on top of Gavel is Dredd, framework which tests HTTP APIs against their documentation.


Command-line Interface

Gavel's CLI works well together with curl --trace and the curl-trace-parser utility:

$ curl --trace - http://httpbin.org/ip | curl-trace-parser > expected
$ curl --trace - http://httpbin.org/ip | curl-trace-parser > actual
$ cat actual | gavel expected
$ echo $?

To learn more about the CLI, head to the Command-line interface topic.


See following paragraphs for a basic overview of how Gavel works. To learn more about the expectations, head to the General validation behavior topic.

Response status

Status code of the expected response must be the same as the one in the actual response.

Request and response headers

  • All expected request headers must be present in the actual request. The same applies for responses.
  • Names of headers are validated in case-insensitive way.
  • Only values of headers significant for content negotiation are validated.
  • All other header values can differ.

For more information see the respective topic.

Request and response body


  1. Gavel.js - JavaScript implementation
  2. General Validation Behavior
  3. add-implementation
  4. Command-line interface
  5. Data validators and output format

Last published over 3 years ago by honzajavorek.