Skip to content

Commit

Permalink
Merge pull request aio-libs#144 from KeepSafe/issue_141
Browse files Browse the repository at this point in the history
Don't append data to path for GET request
  • Loading branch information
asvetlov committed Aug 28, 2014
2 parents 4133c67 + da583fb commit 4c83197
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
10 changes: 2 additions & 8 deletions aiohttp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def __init__(self, method, url, *,

self.update_version(version)
self.update_host(url)
self.update_path(params, data)
self.update_path(params)
self.update_headers(headers)
self.update_cookies(cookies)
self.update_content_encoding()
Expand Down Expand Up @@ -264,7 +264,7 @@ def update_version(self, version):
.format(version)) from None
self.version = version

def update_path(self, params, data):
def update_path(self, params):
"""Build path."""
# extract path
scheme, netloc, path, query, fragment = urllib.parse.urlsplit(self.url)
Expand All @@ -276,12 +276,6 @@ def update_path(self, params, data):
elif isinstance(params, MultiDict):
params = list(params.items(getall=True))

# for GET request include data to query params
if data and self.method in self.GET_METHODS:
if isinstance(data, dict):
data = data.items()
params = list(itertools.chain(params or (), data))

if params:
params = urllib.parse.urlencode(params)
if query:
Expand Down
3 changes: 2 additions & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,8 @@ def test_get_with_data(self):
for meth in ClientRequest.GET_METHODS:
req = ClientRequest(
meth, 'http:https://python.org/', data={'life': '42'})
self.assertEqual('/?life=42', req.path)
self.assertEqual('/', req.path)
self.assertEqual(b'life=42', req.body)

def test_bytes_data(self):
for meth in ClientRequest.POST_METHODS:
Expand Down

0 comments on commit 4c83197

Please sign in to comment.