Skip to content

net/http, net/textproto: add a Header method to get multiple values []string, with canonicalized key  #34799

Description

@trung

In order to get multiple values from a header, we have to use a standard map expression. However, we need to be aware that keys are canonicalized (header["My-Key"]) otherwise header["my-key"] will not return any value. Or need to use textproto.CanonicalMIMEHeaderKey() explicitly.

header.Get(key) allows to get the first value and internally uses textproto.CanonicalMIMEHeaderKey to canonicalize the key before getting the value.

Is there a reason not to provide, something likeheader.GetValues(key), which returns []string?

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRequestIssues asking for a new feature that does not need a proposal.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions