Skip to content
Myr

Added test case for quoted and illegal characters in the URL.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This is a test case for issue #369. It passes in Python 2, but fails in Python 3 (though the test suite doesn't actually work in Python 3, it can be shown to fail with some modification).

authored by Matt Giuca · committed by Matt Giuca · parent 12f9aa3 · Browse files · 1 file+22 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+22 added−0 removed

  • other:+22 added−0 removed

1 file+22 added−0 removed

modified:test_requests.py+22 added
115 unmodified lines
116117 requests.get(url=httpbin('get'), headers=heads)118119120 def test_session_with_escaped_url(self):121 # Test a URL that contains percent-escaped characters122 # This URL should not be modified (double-escaped)123 # Tests:124 # - Quoted illegal characters ("%20" (' '), "%3C" ('<'), "%3E" ('>'))125 # - Quoted reserved characters ("%25" ('%'), "%23" ('#'), "%2F" ('/'))126 # - Quoted non-ASCII characters ("%C3%98", "%C3%A5")127 path_fully_escaped = '%3Ca%25b%23c%2Fd%3E/%C3%98%20%C3%A5'128 url = httpbin('get/' + path_fully_escaped)129 response = get(url)130 self.assertEqual(response.url, httpbin('get/' + path_fully_escaped))131132 # Test that illegal characters in a path get properly percent-escaped133 # Tests:134 # - Bare illegal characters (space, '<')135 # - Bare non-ASCII characters ('\u00d8')136 path = u'<a%25b%23c%2Fd%3E/\u00d8 %C3%A5'137 url = httpbin('get/' + path)138 response = get(url)139 self.assertEqual(response.url, httpbin('get/' + path_fully_escaped))140141142 def test_user_agent_transfers(self):143 """Issue XX"""144145 heads = {
613 unmodified lines