Support for Case-Sensitive HTTP Headers in Karate Mock Server #2653
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Dear Karate Mock Team,
I truly appreciate your time and effort in developing and maintaining the Karate mock server as an open-source project.
Recently, I needed to integrate the mock server for testing with a legacy system that requires HTTP/1 headers or specific header formats. For example, the system expects the header exactly as "X-Special-Header" and not "x-special-header" to function correctly.
I noticed that even after configuring the
lowerCaseResponseHeaders
property to false, the headers were still converted to lowercase due to Armeria server’s adherence to HTTP/2/gRPC standards.Fortunately, the Armeria team has provided an interface for mapping HTTP/2 headers to HTTP/1 headers Armeria Issue #3196., but it requires manual mapping. My initial thought was to provide an option for specifying HTTP/1 header configurations, for example:
This option could then be used to map headers in the Armeria server like so:
However, I believe it would be a better solution to collect the original HTTP headers directly from the provided
Scenario
and use them as references for mapping, rather than manually specifying each header through configuration options.I have made an initial attempt at implementing this solution, and it worked as I tested myself. However, this may not work when performing high TPS or load testing. My solution currently uses the same
httpHeaderReference
fromHttpHeaderTracking
, but different features might require different header formats. For instance:In such cases, headers may override each other since HTTP/2 uses lowercase for mapping. While we could add the scenario as a prefix to the
httpHeaderReference
, I believe it's a rare situation to have different scenarios with different header formats. Therefore, I have provided a simpler solution for now.Thank you for your attention, and I look forward to hearing your thoughts on this.
Best regards,