Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions aiohttp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ def _request(self, method, url, *,
r_url = urllib.parse.urljoin(url, r_url)

url = r_url
params = None
yield from resp.release()
continue

Expand Down
3 changes: 2 additions & 1 deletion docs/client_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ The client session supports context manager protocol for self closing.

:param params: Mapping, iterable of tuple of *key*/*value* pairs or
string to be sent as parameters in the query
string of the new request (optional)
string of the new request. Ignored for subsequent
redirected requests (optional)

Allowed values are:

Expand Down
22 changes: 22 additions & 0 deletions tests/test_client_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,28 @@ def handler(request):
yield from resp.release()


@pytest.mark.run_loop
def test_drop_params_on_redirect(create_app_and_client):
@asyncio.coroutine
def handler_redirect(request):
return web.Response(status=301, headers={'Location': '/ok?a=redirect'})

@asyncio.coroutine
def handler_ok(request):
assert request.query_string == 'a=redirect'
return web.Response(status=200)

app, client = yield from create_app_and_client()
app.router.add_route('GET', '/ok', handler_ok)
app.router.add_route('GET', '/redirect', handler_redirect)

resp = yield from client.get('/redirect', params={'a': 'initial'})
try:
assert resp.status == 200
finally:
yield from resp.release()


@pytest.mark.run_loop
def test_history(create_app_and_client):
@asyncio.coroutine
Expand Down