Skip to content

Commit faf611a

Browse files
d1str0bradfitz
authored andcommitted
net/http: rename Post's parameter from bodyType to contentType
Change-Id: Ie1b08215c02ce3ec72a4752f4b800f23345ff99d Reviewed-on: https://go-review.googlesource.com/29362 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
1 parent 75ce89c commit faf611a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/net/http/client.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -571,8 +571,8 @@ func defaultCheckRedirect(req *Request, via []*Request) error {
571571
// Post is a wrapper around DefaultClient.Post.
572572
//
573573
// To set custom headers, use NewRequest and DefaultClient.Do.
574-
func Post(url string, bodyType string, body io.Reader) (resp *Response, err error) {
575-
return DefaultClient.Post(url, bodyType, body)
574+
func Post(url string, contentType string, body io.Reader) (resp *Response, err error) {
575+
return DefaultClient.Post(url, contentType, body)
576576
}
577577

578578
// 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
583583
// request.
584584
//
585585
// To set custom headers, use NewRequest and Client.Do.
586-
func (c *Client) Post(url string, bodyType string, body io.Reader) (resp *Response, err error) {
586+
func (c *Client) Post(url string, contentType string, body io.Reader) (resp *Response, err error) {
587587
req, err := NewRequest("POST", url, body)
588588
if err != nil {
589589
return nil, err
590590
}
591-
req.Header.Set("Content-Type", bodyType)
591+
req.Header.Set("Content-Type", contentType)
592592
return c.doFollowingRedirects(req, shouldRedirectPost)
593593
}
594594

0 commit comments

Comments
 (0)