Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Reliability] HTTP Headers should be processed as IgnoreCase #5759

Closed
sima-zhu opened this issue Oct 10, 2019 · 6 comments
Closed

[Reliability] HTTP Headers should be processed as IgnoreCase #5759

sima-zhu opened this issue Oct 10, 2019 · 6 comments
Assignees
Labels
Azure.Core azure-core blocking-release Blocks release customer-reported Issues that are reported by GitHub users external to the Azure organization.

Comments

@sima-zhu
Copy link
Contributor

Customer reported issue: #5623

Http headers are case insensitive so our deserializer cannot depend on case sensitive properties.
The current proposal of fixing the issue from @anuchandy and @jianghaolu :

  1. During code generation we know the types representing Http headers. The properties of these types will have @JsonProperty with lower-case value.
  2. For azure-core HttpClient, we will define a contract that all the Http header names in response HttpHeaders type will be lowercase. For built-in netty and okhttp clients we will do this normalization when we receives a response. here:
    reactorNettyResponse.responseHeaders().forEach(e -> headers.put(e.getKey(), e.getValue()));
  3. The HttpResponseHeaderDecoder first serializes this normalized HttpHeaders (it’s a Map<String, String>) to json, now we have a json with all keys as lowercase, then we deserialize this json to generated Header type, which also has lowercase jsonProperty values.
@sima-zhu sima-zhu added the Azure.Core azure-core label Oct 10, 2019
@sima-zhu sima-zhu self-assigned this Oct 10, 2019
@sima-zhu sima-zhu added the blocking-release Blocks release label Oct 10, 2019
@joshfree joshfree changed the title Make headers key lower case and deserialize from lower case properties HTTP Headers should be processed as IgnoreCase Oct 10, 2019
@joshfree joshfree changed the title HTTP Headers should be processed as IgnoreCase [Reliability] HTTP Headers should be processed as IgnoreCase Oct 10, 2019
@sima-zhu
Copy link
Contributor Author

@jianghaolu Could you update here for the autorest change status?

@joshfree joshfree added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Oct 14, 2019
@sima-zhu
Copy link
Contributor Author

#5839

@sima-zhu
Copy link
Contributor Author

sima-zhu commented Oct 15, 2019

Closed the one above and opened a new one below
#5841

@sima-zhu
Copy link
Contributor Author

The annotation for JsonFormat does not work.
Now approach another way, add the feature config in JacksonAdaptor for header mapper only.
PR: #5844

@sima-zhu
Copy link
Contributor Author

Merged in the fix 3e03bf2

@ghost
Copy link

ghost commented Oct 15, 2019

Thanks for working with Microsoft on GitHub! Tell us how you feel about your experience using the reactions on this comment.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Core azure-core blocking-release Blocks release customer-reported Issues that are reported by GitHub users external to the Azure organization.
Projects
None yet
Development

No branches or pull requests

5 participants