-
Notifications
You must be signed in to change notification settings - Fork 743
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
iOS client not properly escaping "+" sign when using GET for queries #1652
Comments
Thanks for bringing this to our attention. I'm working on a PR to correct this right now! |
@winstondu I've pushed up PR #1653 to fix this. Would you mind applying the fix locally and testing to confirm this fixes your issue? Assuming it does, we will push a new patch version with this fix in the next few days! |
@AnthonyMDev , it does not. I suspect there also needs to be a corresponding fix to the ApolloServer library to add decoding. The server now sees the string as a "%2b". |
Ahhhh, that's not great... haha. I was hoping it was just a simple client side fix. I'll have to get someone from our server team involved to see what the correct behavior for this is. |
@winstondu I took another stab at it - I think maybe percent encoding the parameter before getting to the query level might do it. Can you pull that branch again and give it another shot? |
@designatednerd , this was actually what I tried to do as a workaround, but unfortunately the server just sees it as "%2b". It doesn't decode it at all. |
wait, i thought you were saying that it was seeing |
@designatednerd , I will need to test your fix, but it looks substantially similar to something I tried before reporting the issue, and the server saw |
OK - would appreciate it if you could confirm what you're seeing when using the double-encoded property - that'll help. |
Hey @winstondu were you able to confirm what you get when you're using the double-encoded property? Thank you! |
I will test right now. |
@designatednerd , yup, when I log what I receive from the resolver , the server receives We're using |
Interesting that it gets the same thing whether it's single or double encoded! I'll talk to server folk and get back to you. |
Thanks. I appreciate it. Again, it's only for GET queries. (POST works fine) |
yeah there's something goofy going on with the URL encoding, I'm not super-sure what though |
OK, so in talking to some folks and running a few things through URL encoder/decoders online:
Does any of that help, @winstondu? |
@winstondu Were you able to find anything on the above? |
@designatednerd , sorry about taking my time. Unfortunately not yet. Could you circle back to me later this week? |
Yep just wanted to check in! I may wind up merging that open PR since I've verified that it works with assorted URL decoders, but I'll leave this open a bit longer. |
silly merge auto-closing things, that's not what i wanted |
Closing due to inactivity. If this is still an issue for you please reply in this issue - thank you. |
Bug report
When strings are an input variable to a query, that input is not correctly sent to the server. In particular, "+" characters are changed into " " characters when converting into the GET query.
See: https://stackoverflow.com/a/24888789/7612797
We had a very simple query our graphQL server was supporting.
Often, the
$phone
variable may include a "+" sign in front (e.g. "+1-555-554-0909").When querying the web console, this input variable is correctly received by the server. But when querying from the iOS client, the server somehow does not get the "+" sign. (e.g. "+1-555-554-0909" becomes " 1-555-554-0909" ).
Versions
Please fill in the versions you're currently using:
apollo-ios
SDK version: 0.41.0Steps to reproduce
See description
Further info
Since the iOS client is using GET queries, strings should therefore be URL-encoded.
Generated code is as follows:
The text was updated successfully, but these errors were encountered: