`last_request.querystring` converting escaped pluses to spaces
See original GitHub issueWe are using HTTPretty for testing requests that carry along email addresses. Sometimes email addresses have +'s
in them which are escaped to %2B
. When they are being reversed for assertion in HTTPretty, it seems to be unescaping too many times in querystring
(leading to a
).
# Open request with escaped `+` in it
urllib2.urlopen('http://test.domain/?hello=world&email=todd%2Btest%40underdog.io')
# Look at request received by httpretty
last_request = httpretty.last_request()
print last_request.path # /?hello=world&email=todd%2Btest%40underdog.io
print last_request.querystring # {u'hello': [u'world'], u'email': [u'todd test@underdog.io']}
I have created a proof of concept to reproduce the issue:
https://gist.github.com/twolfson/9950fbeb31fc4f3ac33f
I will be attempting to follow up with a PR to remedy the issue fully.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Angular url plus sign converting to space - Stack Overflow
I have angular application where i want to pass plus sign + in query string like: http ...
Read more >Forcing %s to escape spaces with plus instead of percent twenty
Within an URL it makes sense to convert a space to %20 , whereas in a parameter the + is used. Unfortunately, they're...
Read more >Spaces in query strings get encoded as + plus signs instead of ...
In the Java client, when producing a URL, space characters in query strings get encoded as + plus signs instead of %20.
Read more >Use %20 instead of + to encode spaces when submitting a ...
Secondly, with REST api, OutSystems provides you the "On Before Request", you can implement things to prevent the conversion here.
Read more >URL escape codes
Character URL Escape Codes String Literal Escape Code
SPACE %20 $20
< %3C $3C
> %3E $3E
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
triaging this ticket, will work on it after next release 1.0.0
No PR fix was submitted due to running out of time. Sorry, I should have clarified by no longer having access to the repo, I meant I don’t recall the workaround and can’t look it up due to not having access to the repo =/
The guesses above are the best I’ve got