question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`last_request.querystring` converting escaped pluses to spaces

See original GitHub issue

We 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:open
  • Created 8 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
gabrielfalcaocommented, Mar 11, 2020

triaging this ticket, will work on it after next release 1.0.0

0reactions
twolfsoncommented, Jul 15, 2018

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found