Skip to content

HTTP response headers matching should be case-insensitive #558

@igea-jure

Description

@igea-jure

When testing a WMS service, we've encountered many failed tests that were caused by checking case-sensitive HTTP response headers. According to HTTP/1 specification, all HTTP headers are case-insensitive. According to HTTP/2, they should all be in lowercase.

We are using HAProxy as our reverse proxy, which follows this specifications and converts all HTTP headers to lowercase.

Example: our view service, located here, fails at test at51-getmap-request-parameter at assertion Fail if service does not return OWS Exception Report. This assertion checks the content of HTTP response header Content-Type (note the word capitalization). Since our response headers are lowercase (i.e. content-type), the test fails. We believe this is not correct behaviour. Link to Test report from official INSPIRE validator is here.

Solution (for testing view services):

  • Most response headers are read with method messageExchange.getResponseHeaders().get(...) - these should probably be changed to messageExchange.getResponseHeaders().getCaseInsensitive(...) (docs).
  • I've also found calls to testRequest.response.responseHeaders.get(...). Converting these calls to testRequest.response.responseHeaders.getCaseInsensitive(...) should also do the trick, since it seems that the responseHeaders is also an instance of object StringToStringsMap (just like above).

We have ran into this issue when testing view services, but the same issue might also exist in other tests.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Production: latest release

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions