Skip to content

Missing HTTP headers get reported as the empty string #450

@enobayram

Description

@enobayram

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions