-
Notifications
You must be signed in to change notification settings - Fork 123
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
Query parameters with Map values are not properly encoded #283
Comments
You could simply encode that map into a JSON string using |
True. But this is happening within a library generator that uses chopper as a dependency. I'd rather see it fixed than convince the author of the generator(s) to work around it. |
Furthermore, if formatting of the value is required prior to passing it to chopper, then chopper should specify the type it expects (such as string) or throw when an unencodable type is used. |
@point-source This should have been fixed in this PR already #364 {
"Field": "QuoteNumber",
"Op": "=",
"Value": "306142"
} would get encoded as
Check the PR comments for more examples. |
Great to know, thanks! |
Using chopper 4.0.1, I am trying to encode a query param called "filter" which accepts a map with this structure:
The correct encoding of this is:
filter=%7B%0A%20%20%22Field%22%3A%20%22QuoteNumber%22%2C%0A%20%20%22Op%22%3A%20%22%3D%22%2C%0A%20%20%22Value%22%3A%20%22306142%22%0A%7D
But chopper encodes it as:
filter=%7BField%3A+QuoteNumber%2C+Op%3A+%3D%2C+Value%3A+306142%7D
which gets decoded to:
{Field:+QuoteNumber,+Op:+=,+Value:+306142}
This is obviously not valid json for a number of reasons and as a result, the server throws a 400 or 500 error.
The text was updated successfully, but these errors were encountered: