Skip to content

Content-Encoding header is not being properly parsed #959

@mmukahhal-tibco

Description

@mmukahhal-tibco

Content encodings can be supplied by multiple Content-Encoding headers or by one header with a comma separated list of encodings as seen here.

The Header map embedded in an http.Request from the Go standard library states that:

Header contains the request header fields either received by the server or to be sent by the client.

If a server received a request with header lines,

Host: example.com
accept-encoding: gzip, deflate
Accept-Language: en-us
fOO: Bar
foo: two
then

Header = map[string][]string{
    "Accept-Encoding": {"gzip, deflate"},
    "Accept-Language": {"en-us"},
    "Foo": {"Bar", "two"},
}

As seen by the Accept-Encoding header, this means a comma separated list of values will be returned as a []string with a single element.

Currently, chi does not make this distinction, and so it is not properly parsing the Content-Encoding header.

I will submit a PR fixing this issue shortly.

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