You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just fell into a problem calling a rest api that returned an error on a GET request, because Resty added a header Content-Type: application/json in my GET request. (no idea why they check that, and fortunately the returned error was explicit)
my code looks like: reponse, err := client.R().SetPathParams(pathparams).SetQueryParams(params).SetResult(typ).Get( url)
It does it for me, which is great, but not sure the current behiavour is legit..
It's not forbidden by the rfc but afaik this header should only be present in requests sending a body,
i'm not sure if it is an issue or not, (and i'm way too shallow on http to debate that, but I thought you might be interested in case no one reported it before.
Also, in resty traces i see "Content-Type:", so i'm not sure if my content-type header is sent or not by the library..
nor if it is the right way to remove an unwanted header.
I tried to replace the req.Header[...]=nil with a delete, but it didn't work.
The text was updated successfully, but these errors were encountered:
Hello,
I just fell into a problem calling a rest api that returned an error on a GET request, because Resty added a header Content-Type: application/json in my GET request. (no idea why they check that, and fortunately the returned error was explicit)
my code looks like:
reponse, err := client.R().SetPathParams(pathparams).SetQueryParams(params).SetResult(typ).Get( url)
So I added a "middleware" function
It does it for me, which is great, but not sure the current behiavour is legit..
It's not forbidden by the rfc but afaik this header should only be present in requests sending a body,
i'm not sure if it is an issue or not, (and i'm way too shallow on http to debate that, but I thought you might be interested in case no one reported it before.
Also, in resty traces i see "Content-Type:", so i'm not sure if my content-type header is sent or not by the library..
nor if it is the right way to remove an unwanted header.
I tried to replace the req.Header[...]=nil with a delete, but it didn't work.
The text was updated successfully, but these errors were encountered: