-
Notifications
You must be signed in to change notification settings - Fork 698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SetResult fails to parse JSON when the returned Content-Type is "application/x-amz-json-1.1" #594
Comments
As a workaround, you can set |
tsbkw
added a commit
to tsbkw/resty
that referenced
this issue
Oct 31, 2022
[Issue go-resty#594](go-resty#594) can be workaround by set `application/json` as ForceContentType, but content-type may be different depends on response, and ForceContentType assumes that server always return same content type. AddForceUnmarshalRule enables unmarshal depends on content-type from server. Previously createGenServer return xml response without root element and it cannot be unmarshalled because encoding/xml.Unmarshal is only unmarshal chidlren of root element. Now add root element in response and change assertion in test case accordingly.
tsbkw
added a commit
to tsbkw/resty
that referenced
this issue
Oct 31, 2022
[Issue go-resty#594](go-resty#594) can be worked around by set `application/json` as ForceContentType, but content-type may be different depends on response, and ForceContentType assumes that server always return same content type. AddForceUnmarshalRule enables unmarshal depends on content-type from server. Previously createGenServer return xml response without root element and it cannot be unmarshalled because encoding/xml.Unmarshal is only unmarshal chidlren of root element. Now add root element in response and change assertion in test case accordingly.
@segevda Thanks! |
jeevatkm
added a commit
that referenced
this issue
Sep 23, 2023
jeevatkm
added a commit
that referenced
this issue
Sep 24, 2023
jeevatkm
added a commit
that referenced
this issue
Sep 24, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found the SetResult API fails to parse the result JSON if the
Content-Type
is equal to "application/x-amz-json-1.1" (which Amazon uses for some endpoints). Would it be possible to add this as a supported Content-Type, or possibly support setting a custom JSON Content-Type for resty?Looks like this is the regex that is failing to match: https://github.com/go-resty/resty/blob/master/client.go#L63
The text was updated successfully, but these errors were encountered: