Unverified Commit f9a0483f authored by Sander van Harmelen's avatar Sander van Harmelen Committed by GitHub

Merge pull request #538 from xanzy/b-get-body

Set request.GetBody to fix redirect issues
parents bf34eca5 d3aa1530
...@@ -562,6 +562,9 @@ func (c *Client) NewRequest(method, path string, opt interface{}, options []Opti ...@@ -562,6 +562,9 @@ func (c *Client) NewRequest(method, path string, opt interface{}, options []Opti
u.RawQuery = "" u.RawQuery = ""
req.Body = ioutil.NopCloser(bodyReader) req.Body = ioutil.NopCloser(bodyReader)
req.GetBody = func() (io.ReadCloser, error) {
return ioutil.NopCloser(bodyReader), nil
}
req.ContentLength = int64(bodyReader.Len()) req.ContentLength = int64(bodyReader.Len())
req.Header.Set("Content-Type", "application/json") req.Header.Set("Content-Type", "application/json")
} }
......
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