]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: document NewRequest treating Reader as ReadCloser
authorBrad Fitzpatrick <bradfitz@golang.org>
Thu, 18 Jul 2013 00:10:10 +0000 (10:10 +1000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Thu, 18 Jul 2013 00:10:10 +0000 (10:10 +1000)
R=golang-dev, dsymonds, rogpeppe
CC=golang-dev
https://golang.org/cl/11432044

src/pkg/net/http/request.go

index 6d4569146fdd44d6e3d902c8f13c478865667865..3b29aefcd0340bb33c8e6aa9ee6c2a6fef06dc5f 100644 (file)
@@ -424,6 +424,10 @@ func ParseHTTPVersion(vers string) (major, minor int, ok bool) {
 }
 
 // NewRequest returns a new Request given a method, URL, and optional body.
+//
+// If the provided body is also an io.Closer, the returned
+// Request.Body is set to body and will be closed by the Client
+// methods Do, Post, and PostForm, and Transport.RoundTrip.
 func NewRequest(method, urlStr string, body io.Reader) (*Request, error) {
        u, err := url.Parse(urlStr)
        if err != nil {