Commit 4aa6d353 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

net/http: document NewRequest treating Reader as ReadCloser

R=golang-dev, dsymonds, rogpeppe
CC=golang-dev
https://golang.org/cl/11432044
parent 1da96a30
...@@ -424,6 +424,10 @@ func ParseHTTPVersion(vers string) (major, minor int, ok bool) { ...@@ -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. // 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) { func NewRequest(method, urlStr string, body io.Reader) (*Request, error) {
u, err := url.Parse(urlStr) u, err := url.Parse(urlStr)
if err != nil { if err != nil {
......
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