To add a collaborator to this project you will need to use the Relish gem to add the collaborator via a terminal command. Soon you'll be able to also add collaborators here!More about adding a collaborator
Behavior spec for 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.
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 $? 0
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.
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
- If the body is JSON, Gavel validates only its structure. - Bodies in any other format are validated as plain text.
- If Gavel is provided with JSON Schema, it overrides the default validation behavior.
- General Validation Behavior
- Command-line interface
- Data validators and output format
Last published about 3 years ago by honzajavorek.