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

net/mail: not clear that Header.Get is case insensitive #18019

Closed
mvdan opened this issue Nov 22, 2016 · 1 comment
Closed

net/mail: not clear that Header.Get is case insensitive #18019

mvdan opened this issue Nov 22, 2016 · 1 comment

Comments

@mvdan
Copy link
Member

@mvdan mvdan commented Nov 22, 2016

Reading the godoc:

    func (h Header) Get(key string) string

Get gets the first value associated with the given key. If there are no values associated with the key, Get returns "".

It's not immediately obvious that key is not case sensitive. As it turns out, Get("From") and Get("from") mean the same because internally this all goes through https://golang.org/pkg/net/textproto/#CanonicalMIMEHeaderKey.

Perhaps this is just me not being used to MIME Headers being canonical in this way. But I think a sentence like "note that key is case insensitive as it is canonicalized" would help some people. The net/mail godoc does not mention MIME headers anywhere either.

Perhaps this should go in net/textproto too, even though that's much closer to the actual CanonicalMIMEHeaderKey func.

@gopherbot
Copy link

@gopherbot gopherbot commented Nov 23, 2016

CL https://golang.org/cl/33530 mentions this issue.

@gopherbot gopherbot closed this in e2d5e54 Nov 28, 2016
@golang golang locked and limited conversation to collaborators Nov 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.