Skip to content

net/http: docs are wrong for multiple headers with same key #5979

@josharian

Description

@josharian
What steps will reproduce the problem?

Run http://play.golang.org/p/SmkSnOoyAC locally. For reference, here is a sample
response from that http server:

HTTP/1.1 200 OK
Custom: a
Custom: b
Content-Type: text/plain; charset=utf-8
Content-Length: 0
Date: Sun, 28 Jul 2013 21:02:11 GMT


What is the expected output?

The documentation for http.Response reads: "If the response had multiple headers
with the same key, they will be concatenated, with comma delimiters.  (Section 4.2 of
RFC 2616 requires that multiple headers be semantically equivalent to a comma-delimited
sequence.)"

Given that, I'd expect to see "[a, b]" (a slice containing a single string,
"a, b").


What do you see instead?

"[a b]" (a slice containing two strings, "a" and "b").


Which compiler are you using (5g, 6g, 8g, gccgo)?

6g


Which operating system are you using?

OS X


Which version are you using?  (run 'go version')

1.1


Please provide any additional information below.

It is not obvious to me whether the behavior or the documentation should be changed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions