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

Streamed response headers are case sensitive #908

Closed
GithubUser8080 opened this issue Jul 4, 2024 · 8 comments · Fixed by #912
Closed

Streamed response headers are case sensitive #908

GithubUser8080 opened this issue Jul 4, 2024 · 8 comments · Fixed by #912

Comments

@GithubUser8080
Copy link

GithubUser8080 commented Jul 4, 2024

When the request has .streamed(), then all methods to get headers, like response.getContentType() fail if the case is not an exact match. E.g for response Content-Type : application/json, response.getContentType() returns octet-stream. It only succeeds if the headers are all lowercase. Normally header matching must be case insensitive.

@GithubUser8080 GithubUser8080 changed the title Streamed response headers are not case sensitive Streamed response headers are case sensitive Jul 4, 2024
@mkurz
Copy link
Member

mkurz commented Jul 8, 2024

@GithubUser8080 Just taking a quick look, maybe this line could be related?

def contentType: String = header("Content-Type").getOrElse("application/octet-stream")

@GithubUser8080
Copy link
Author

@GithubUser8080 Just taking a quick look, maybe this line could be related?

def contentType: String = header("Content-Type").getOrElse("application/octet-stream")

I will try to remember the exact line, but if i remember correctly, all other response types, when getting headers, return a TreeMap copy of headers with case insensitive keys. Whereas StreamedResponse getHeaders() returns the original case sensitive map of headers from the underlying response.

@GithubUser8080
Copy link
Author

Normal response

Streamed response

public Map<String, List<String>> getHeaders() {

@mkurz
Copy link
Member

mkurz commented Jul 8, 2024

@GithubUser8080
Copy link
Author

Thanks

@mkurz
Copy link
Member

mkurz commented Jul 9, 2024

Please let me now if that works for you now, thanks!

@GithubUser8080
Copy link
Author

Please let me now if that works for you now, thanks!

It does, thank you for the fast response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants