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

Missing HTTP headers get reported as the empty string #450

Open
enobayram opened this issue Jan 11, 2023 · 0 comments
Open

Missing HTTP headers get reported as the empty string #450

enobayram opened this issue Jan 11, 2023 · 0 comments

Comments

@enobayram
Copy link

When the _xhrRequestConfig_responseHeaders of an XhrRequest gets configured as OnlyHeaders $ singleton "SomeHeader", the _xhrResponse_headers map of the resulting XhrResponse contains a value of "" for the SomeHeader header, even if the actual HTTP response doesn't contain any SomeHeader header.

I think this behavior is very surprising; It's unintuitive and it's inconsistent with configuring the XhrRequest as _xhrRequestConfig_responseHeaders = AllHeaders, which will (necessarily) return an XhrResponse with a _xhrResponse_headers map without a SomeHeader value.

I believe this fromMaybe "" is responsible for that behavior, and I don't understand what purpose it really serves by conflating the missing header vs. header with empty string cases:

xmlHttpRequestGetResponseHeader self header = fromMaybe "" <$> getResponseHeader self header

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

No branches or pull requests

1 participant