From 08bc1198d3ed312ab5ce60c29d8447dd5d3f90ea Mon Sep 17 00:00:00 2001 From: Matt Giuca Date: Tue, 14 Feb 2012 12:15:32 +1100 Subject: [PATCH] Added test case for Issue #369. Tests that legal reserved and unreserved characters in the path are not percent-encoded. Currently fails. --- test_requests.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test_requests.py b/test_requests.py index 4f9275c8..1168d3bd 100644 --- a/test_requests.py +++ b/test_requests.py @@ -138,6 +138,20 @@ class RequestsTestSuite(TestSetup, unittest.TestCase): response = get(url) self.assertEqual(response.url, httpbin('get/' + path_fully_escaped)) + # Test that reserved characters in a path do not get percent-escaped + # Tests: + # - All reserved characters (RFC 3986), except '?', '#', '[' and ']', + # which are not allowed in the path, and ';' which delimits + # parameters. + # All such characters must be allowed bare in path, and must not be + # encoded. + # - Special unreserved characters (RFC 3986), which should not be + # encoded (even though it wouldn't hurt). + path_reserved = '!$&\'()*+,/:=@-._~' + url = httpbin('get/' + path_reserved) + response = get(url) + self.assertEqual(response.url, httpbin('get/' + path_reserved)) + def test_user_agent_transfers(self): """Issue XX"""