Closed gg718 closed 10 months ago
Summary
I am not sure exactly when this was broken, but it works as expected in v3.37.2 and does not work in v3.40.1, so at some point between then, calling SetBody on the request seems to disregard the Content-Type set at the global level.
SetBody
Content-Type
Repro
package main import ( "github.com/imroc/req/v3" ) func main() { client := req.C(). DevMode(). SetCommonContentType("application/json") _, _ = client.R().SetBody("").Post("https://example.com") }
Expected
... content-type: application/json; charset=utf-8 ...
Actual
... content-type: text/plain; charset=utf-8 ...
Nice catch! It's been fixed in the latest release.
Thanks for the speedy fix!
Summary
I am not sure exactly when this was broken, but it works as expected in v3.37.2 and does not work in v3.40.1, so at some point between then, calling
SetBody
on the request seems to disregard theContent-Type
set at the global level.Repro
Expected
Actual