-1

Actually I was trying to migrate my old test suite to Karate framework. And I have to validate response headers, In that "Content-Encoding" header is not returned in Karate GET call - I checked it in results I could see all other response headers but not "Content-Encoding" and returns null for assertion.

The same GET call I checked it in chrome browser - developer console and POSTMAN in both the tools I could get "Content-Encoding" but not in Karate.

Please help me in this.

Madhan
  • 671
  • 2
  • 12
  • 25

2 Answers2

0

If the server returns Content-Encoding you will see it else you will not.

To validate that a header does NOT exist, it is simple:

And match responseHeaders contains { 'Content-Encoding': '#notpresent' }

Refer responseHeaders: https://github.com/intuit/karate#responseheaders

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
0

Unfortunately it does not provide all response headers, because some, like "Content-Encoding: gzip" are stripped away by underlying Apache http libraries after decompressing the content it seems.

See: Having trouble getting content-encoding to show up in response header for get request