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/httptest: http.Response.ContentLength not set in httptest.ResponseRecorder.Result() #16952

Closed
Thomasdezeeuw opened this issue Sep 1, 2016 · 2 comments

Comments

@Thomasdezeeuw
Copy link
Contributor

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go1.7

What operating system and processor architecture are you using (go env)?

n/a.

What did you do?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

See https://play.golang.org/p/pWT6IMacni.

What did you expect to see?

Expected the Response.ContentLength to be set. Since a bytes.Buffer is used for recording the response body, the content length can be set using Buffer.Len.

What did you see instead?

As seen in https://github.com/golang/go/blob/master/src/net/http/httptest/recorder.go#L143-L188, the Response.ContentLength is never set.

I could write a patch if it would be accepted.

@gopherbot
Copy link

CL https://golang.org/cl/28302 mentions this issue.

@quentinmit quentinmit added this to the Go1.8Maybe milestone Sep 6, 2016
@quentinmit
Copy link
Contributor

/cc @bradfitz

@golang golang locked and limited conversation to collaborators Sep 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants