summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaleb Spare <cespare@gmail.com>2018-06-09 20:14:44 -0700
committerBrad Fitzpatrick <bradfitz@golang.org>2018-06-10 05:49:55 +0000
commita5f83037aeb74032870946c20780e6ba61f326a2 (patch)
treea54bdca6e925cec5905bf63d6d24d5594464696d
parentd67db881465320b46e8142d5eac1b808c3ac659d (diff)
downloadgo-git-a5f83037aeb74032870946c20780e6ba61f326a2.tar.gz
net/http/httptest: deprecate ResponseRecorder.HeaderMap
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>
-rw-r--r--src/net/http/httptest/recorder.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/net/http/httptest/recorder.go b/src/net/http/httptest/recorder.go
index 22170cf98b..1d0310625b 100644
--- a/src/net/http/httptest/recorder.go
+++ b/src/net/http/httptest/recorder.go
@@ -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.