svanoort / pyresttest

Python Rest Testing
Apache License 2.0
1.15k stars 325 forks source link

compare content-encoding fails #189

Closed thebino closed 8 years ago

thebino commented 8 years ago
- compare: {header: "content-encoding", comparator: contains, expected: 'gzip'}

also the extract_test

- extract_test: {header: "content-encoding",  test: "exists"}

both ends in a invalid header name:

ValueError: Invalid header name content-encoding

svanoort commented 8 years ago

This error is thrown when no header with that name is defined in the HTTP response. In this case it means your test is failing.

Remember that to get compressed responses, you must explicitly set the 'Accept-Encoding: deflate, gzip' header on your request to indicate the client can accept compressed content. You can also verify this behavior by running the corresponding curl call, with --verbose and --compresssed.

thebino commented 8 years ago

Thanks, gzip encoding has to be enabled first

- test:
    - curl_option_encoding: "gzip"
svanoort commented 8 years ago

@thebino That works, but a better way is to set the 'accept-encoding: deflate/gzip' header in the test configuration (there is a 'headers' option).