Contents

Command-line interface

@javascript @cli

Installation: npm install -g gavel

Background:

  • Given you record expected raw HTTP messages:
    curl -s --trace - http://httpbin.org/ip | curl-trace-parser > expected 
  • And you record real raw HTTP messages:
    curl -s --trace - http://httpbin.org/ip | curl-trace-parser > real

Scenario: Read and validate real raw HTTP message from STDIN

@stable

  • When you validate the message using the following Gavel command:
    cat real | gavel expected
  • Then exit status is 0

Scenario: Exit status for invalid message

@stable

  • When a header is missing in real messages:
    cat real | grep -v 'Access-Control-Allow-Origin' > real_without_cors
  • And you validate the message using the following Gavel command:
    cat real_without_cors | curl-trace-parser | gavel expected
  • Then exit status is 1

Source: features/cli.feature at v3.0.2, Gavel (MIT license).