Commit a5f83037 authored by Caleb Spare's avatar Caleb Spare Committed by Brad Fitzpatrick

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/117675Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent d67db881
...@@ -27,9 +27,11 @@ type ResponseRecorder struct { ...@@ -27,9 +27,11 @@ type ResponseRecorder struct {
Code int Code int
// HeaderMap contains the headers explicitly set by the Handler. // 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 // Deprecated: HeaderMap exists for historical compatibility
// automatic Content-Type), use the Result method. // 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 HeaderMap http.Header
// Body is the buffer to which the Handler's Write calls are sent. // Body is the buffer to which the Handler's Write calls are sent.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment