Added setting content-type similar to net/http in Post
This commit is contained in:
parent
648929a894
commit
b9f75dd54f
3
main.go
3
main.go
|
@ -656,11 +656,12 @@ func Get(url string) (response *Response, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func Post(url string, body io.Reader) (response *Response, err error) {
|
||||
func Post(url string, contentType string, body io.Reader) (response *Response, err error) {
|
||||
request, err := NewRequest("POST", url, body)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
request.Header.Add("Content-Type", contentType)
|
||||
response, err = Fetch.Do(request)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue