We have multiple environments and right now one of the environment has to return response header in upper case and other in lower case

Viewed 43

I want response header case is ignored how to achieve this?

  • def header = karate.get("responseHeaders['Content-Type'][0]")
  • print 'header---------', header

If content-type is lower case it prints the value as null while it is present but in upper case how to get response header so it is not case sensitive.

Output:

header--------- null 

I tried this too but it always only read first condition

* def header = karate.get("responseHeaders['Content-Type'][0]" || "responseHeaders['content-type'][0]")

1 Answers

Try reading the docs, search for lowerCaseResponseHeaders:

enter image description here

You can find an example of use here

* configure lowerCaseResponseHeaders = true
Related