diff --git a/src/net/http/httptest/httptest.go b/src/net/http/httptest/httptest.go index e2148a659c1..24545f33f00 100644 --- a/src/net/http/httptest/httptest.go +++ b/src/net/http/httptest/httptest.go @@ -35,6 +35,9 @@ import ( // // NewRequest panics on error for ease of use in testing, where a // panic is acceptable. +// +// To generate an client HTTP request instead of a server request, see +// the NewRequest function in the net/http package. func NewRequest(method, target string, body io.Reader) *http.Request { if method == "" { method = "GET" diff --git a/src/net/http/request.go b/src/net/http/request.go index fb4377285de..fd9ea5494ec 100644 --- a/src/net/http/request.go +++ b/src/net/http/request.go @@ -726,11 +726,11 @@ func validMethod(method string) bool { // methods Do, Post, and PostForm, and Transport.RoundTrip. // // NewRequest returns a Request suitable for use with Client.Do or -// Transport.RoundTrip. -// To create a request for use with testing a Server Handler use either -// ReadRequest or manually update the Request fields. See the Request -// type's documentation for the difference between inbound and outbound -// request fields. +// Transport.RoundTrip. To create a request for use with testing a +// Server Handler, either use the NewRequest function in the +// net/http/httptest package, use ReadRequest, or manually update the +// Request fields. See the Request type's documentation for the +// difference between inbound and outbound request fields. func NewRequest(method, urlStr string, body io.Reader) (*Request, error) { if method == "" { // We document that "" means "GET" for Request.Method, and people have