Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http: clarify docs on ResponseWriter.Write and Response.Write #8991

gopherbot opened this issue Oct 24, 2014 · 3 comments


None yet
3 participants
Copy link

commented Oct 24, 2014

by opennota:

When writing to the http.ResponseWriter, the http.Response's method Write doesn't do
what is expected.

    func handler(w http.ResponseWriter, r *http.Request) {
        resp, _ := client.Get("";)

This will write resp's headers to the *body* of the handler's response, with the
text/plain content type.

A method that *copies* a Response would be helpful.

This comment has been minimized.

Copy link

commented Oct 24, 2014

Comment 1:

We can't change the behavior here even if we wanted to, but we can clarify things in the

Labels changed: added documentation, release-go1.5.

Status changed to Accepted.

@bradfitz bradfitz modified the milestone: Go1.5 Dec 16, 2014

@bradfitz bradfitz removed the release-go1.5 label Dec 16, 2014

@rsc rsc removed accepted labels Apr 14, 2015


This comment has been minimized.

Copy link

commented Apr 28, 2015

CL mentions this issue.

mk0x9 pushed a commit to mk0x9/go that referenced this issue Apr 28, 2015

net/http: documentation updates
Fixes golang#10366 (how to set custom headers)
Fixes golang#9836 (PATCH in PostForm)
Fixes golang#9276 (generating a server-side Request for testing)
Update golang#8991 (clarify Response.Write for now; export ReverseProxy's copy later?)

Change-Id: I95a11bf3bb3eeeeb72775b6ebfbc761641addc35
Reviewed-by: David Crawshaw <>

This comment has been minimized.

Copy link

commented Apr 28, 2015

I don't think there's much more to do here. I looked at exporting the guts of net/http/httputil.ReverseProxy's copy function, but there's nothing to be extracted that can't be used via making a ReverseProxy and then calling its ServeHTTP.

@bradfitz bradfitz closed this Apr 28, 2015

@golang golang locked and limited conversation to collaborators Jun 25, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.