HTTPX escapes already-escaped URLs
I'm trying to request a URL that includes a properly escaped base64-encoded string without reparsing and passing in via params. My expectation was that I'd be able to run something like:
And have HTTPX request example.com with
foo equal to
YmFyIQ%3D%3D. Instead HTTPX passes
I also tried parsing the URL ahead of time:
uri = URI.parse('https://example.com/?foo=YmFyIQ%3D%3D') HTTPX.get(uri)
but this results in the same outcome.
I narrowed it down to this line where Request escapes the URI before parsing it:
I'm not sure what the need for this line is or the implications to existing users, but it seems unnecessary unless people are passing in invalid URLs. A mostly-backwards-compatible change would be to escape and parse strings, but pass through
URI objects unchanged.
Right now my solution is to run:
uri = URI.parse('https://example.com/?foo=YmFyIQ%3D%3D') params = CGI.parse(uri.query) uri.query = nil HTTPX.get(uri, params: params)