]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: document Response.Header values that are subordinate to other fields
authorSameer Ajmani <sameer@golang.org>
Mon, 13 Feb 2017 19:40:48 +0000 (14:40 -0500)
committerSameer Ajmani <sameer@golang.org>
Mon, 13 Feb 2017 20:10:19 +0000 (20:10 +0000)
I noticed that Content-Length may appear in http.Response.Header, but the docs
say it should be omitted.  Per discussion with bradfitz@, updating the docs to
indicate that the struct fields are authoritative.

Change-Id: Id1807ff9d4ba5de425d8b147205f29b18351230f
Reviewed-on: https://go-review.googlesource.com/36842
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/net/http/response.go

index ae118fb386d04fb3ca5022c2077bca403cc46245..1b19088a728147596a8e363dea1ebe408e3a9f74 100644 (file)
@@ -37,9 +37,10 @@ type Response struct {
        // Header maps header keys to values. If the response had multiple
        // headers with the same key, they may be concatenated, with comma
        // delimiters.  (Section 4.2 of RFC 2616 requires that multiple headers
-       // be semantically equivalent to a comma-delimited sequence.) Values
-       // duplicated by other fields in this struct (e.g., ContentLength) are
-       // omitted from Header.
+       // be semantically equivalent to a comma-delimited sequence.) When
+       // Header values are duplicated by other fields in this struct (e.g.,
+       // ContentLength, TransferEncoding, Trailer), the field values are
+       // authoritative.
        //
        // Keys in the map are canonicalized (see CanonicalHeaderKey).
        Header Header