Commit faf611a0 authored by Brady Sullivan's avatar Brady Sullivan Committed by Brad Fitzpatrick

net/http: rename Post's parameter from bodyType to contentType

Change-Id: Ie1b08215c02ce3ec72a4752f4b800f23345ff99d
Reviewed-on: https://go-review.googlesource.com/29362Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 75ce89c2
...@@ -571,8 +571,8 @@ func defaultCheckRedirect(req *Request, via []*Request) error { ...@@ -571,8 +571,8 @@ func defaultCheckRedirect(req *Request, via []*Request) error {
// Post is a wrapper around DefaultClient.Post. // Post is a wrapper around DefaultClient.Post.
// //
// To set custom headers, use NewRequest and DefaultClient.Do. // To set custom headers, use NewRequest and DefaultClient.Do.
func Post(url string, bodyType string, body io.Reader) (resp *Response, err error) { func Post(url string, contentType string, body io.Reader) (resp *Response, err error) {
return DefaultClient.Post(url, bodyType, body) return DefaultClient.Post(url, contentType, body)
} }
// Post issues a POST to the specified URL. // Post issues a POST to the specified URL.
...@@ -583,12 +583,12 @@ func Post(url string, bodyType string, body io.Reader) (resp *Response, err erro ...@@ -583,12 +583,12 @@ func Post(url string, bodyType string, body io.Reader) (resp *Response, err erro
// request. // request.
// //
// To set custom headers, use NewRequest and Client.Do. // To set custom headers, use NewRequest and Client.Do.
func (c *Client) Post(url string, bodyType string, body io.Reader) (resp *Response, err error) { func (c *Client) Post(url string, contentType string, body io.Reader) (resp *Response, err error) {
req, err := NewRequest("POST", url, body) req, err := NewRequest("POST", url, body)
if err != nil { if err != nil {
return nil, err return nil, err
} }
req.Header.Set("Content-Type", bodyType) req.Header.Set("Content-Type", contentType)
return c.doFollowingRedirects(req, shouldRedirectPost) return c.doFollowingRedirects(req, shouldRedirectPost)
} }
......
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