Commit d0d8466a authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

net/http, net/http/httptest: cross-reference the two NewRequest funcs

Updates #18082

Change-Id: I2e65b115b809c1e1bf813f538989d1a1f96b2876
Reviewed-on: https://go-review.googlesource.com/33636Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent f7c351bd
...@@ -35,6 +35,9 @@ import ( ...@@ -35,6 +35,9 @@ import (
// //
// NewRequest panics on error for ease of use in testing, where a // NewRequest panics on error for ease of use in testing, where a
// panic is acceptable. // 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 { func NewRequest(method, target string, body io.Reader) *http.Request {
if method == "" { if method == "" {
method = "GET" method = "GET"
......
...@@ -726,11 +726,11 @@ func validMethod(method string) bool { ...@@ -726,11 +726,11 @@ func validMethod(method string) bool {
// methods Do, Post, and PostForm, and Transport.RoundTrip. // methods Do, Post, and PostForm, and Transport.RoundTrip.
// //
// NewRequest returns a Request suitable for use with Client.Do or // NewRequest returns a Request suitable for use with Client.Do or
// Transport.RoundTrip. // Transport.RoundTrip. To create a request for use with testing a
// To create a request for use with testing a Server Handler use either // Server Handler, either use the NewRequest function in the
// ReadRequest or manually update the Request fields. See the Request // net/http/httptest package, use ReadRequest, or manually update the
// type's documentation for the difference between inbound and outbound // Request fields. See the Request type's documentation for the
// request fields. // difference between inbound and outbound request fields.
func NewRequest(method, urlStr string, body io.Reader) (*Request, error) { func NewRequest(method, urlStr string, body io.Reader) (*Request, error) {
if method == "" { if method == "" {
// We document that "" means "GET" for Request.Method, and people have // We document that "" means "GET" for Request.Method, and people have
......
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