]> Cypherpunks repositories - gostls13.git/commitdiff
net/http/httptest: deprecate ResponseRecorder.HeaderMap
authorCaleb Spare <cespare@gmail.com>
Sun, 10 Jun 2018 03:14:44 +0000 (20:14 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Sun, 10 Jun 2018 05:49:55 +0000 (05:49 +0000)
Users of this field are better off using Result instead.

Fixes #25763.

Change-Id: I4391afa6ed3873107628630adc1d409d77fb3f20
Reviewed-on: https://go-review.googlesource.com/117675
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/net/http/httptest/recorder.go

index 22170cf98bd23494114e302061eb848c0a7b3a23..1d0310625b8bb0fec012e905d95e406d8f37fff7 100644 (file)
@@ -27,9 +27,11 @@ type ResponseRecorder struct {
        Code int
 
        // HeaderMap contains the headers explicitly set by the Handler.
+       // It is an internal detail.
        //
-       // To get the implicit headers set by the server (such as
-       // automatic Content-Type), use the Result method.
+       // Deprecated: HeaderMap exists for historical compatibility
+       // and should not be used. To access the headers returned by a handler,
+       // use the Response.Header map as returned by the Result method.
        HeaderMap http.Header
 
        // Body is the buffer to which the Handler's Write calls are sent.