]> Cypherpunks repositories - gostls13.git/commitdiff
net/http, net/http/httptest: cross-reference the two NewRequest funcs
authorBrad Fitzpatrick <bradfitz@golang.org>
Mon, 28 Nov 2016 21:00:29 +0000 (21:00 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 28 Nov 2016 23:53:29 +0000 (23:53 +0000)
Updates #18082

Change-Id: I2e65b115b809c1e1bf813f538989d1a1f96b2876
Reviewed-on: https://go-review.googlesource.com/33636
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/net/http/httptest/httptest.go
src/net/http/request.go

index e2148a659c1bf2346163166047f37c6249e31fb9..24545f33f00041bf043f4480402e88e9e2c8b836 100644 (file)
@@ -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"
index fb4377285de0c7b0c55b5604ded58303e3b53b7c..fd9ea5494eca1dfd0f516d071d2493c2a4818824 100644 (file)
@@ -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