net/http: document NewRequest treating Reader as ReadCloser

R=golang-dev, dsymonds, rogpeppe
CC=golang-dev
https://golang.org/cl/11432044
This commit is contained in:
Brad Fitzpatrick 2013-07-18 10:10:10 +10:00
parent 1da96a3039
commit 4aa6d35306
1 changed files with 4 additions and 0 deletions

View 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 {