Skip to content

Commit

Permalink
Remove fragment string in request path #846
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Aug 27, 2016
1 parent 1a58aa8 commit 01057dc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ CHANGES
- Deprecate debug parameter from app.make_handler(), use
`Application(debug=True)` instead #1121

- Remove fragment string in request path #846


0.22.5 (08-02-2016)
-------------------
Expand Down
4 changes: 2 additions & 2 deletions aiohttp/client_reqrep.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ def update_path(self, params):
query = params

self.path = urllib.parse.urlunsplit(('', '', helpers.requote_uri(path),
query, fragment))
query, ''))
self.url = urllib.parse.urlunsplit(
(scheme, netloc, self.path, '', ''))
(scheme, netloc, self.path, '', fragment))

def update_headers(self, headers):
"""Update request headers."""
Expand Down
14 changes: 12 additions & 2 deletions tests/test_client_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,23 @@ def test_path_safe_chars_preserved(make_request):
def test_params_are_added_before_fragment1(make_request):
req = make_request('GET', "http://example.com/path#fragment",
params={"a": "b"})
assert req.path == "/path?a=b#fragment"
assert req.url == "http://example.com/path?a=b#fragment"


def test_params_are_added_before_fragment2(make_request):
req = make_request('GET', "http://example.com/path?key=value#fragment",
params={"a": "b"})
assert req.path == "/path?key=value&a=b#fragment"
assert req.url == "http://example.com/path?key=value&a=b#fragment"


def test_path_not_contain_fragment1(make_request):
req = make_request('GET', "http://example.com/path#fragment")
assert req.path == "/path"


def test_path_not_contain_fragment2(make_request):
req = make_request('GET', "http://example.com/path?key=value#fragment")
assert req.path == "/path?key=value"


def test_cookies(make_request):
Expand Down

0 comments on commit 01057dc

Please sign in to comment.