diff --git a/CHANGES.txt b/CHANGES.txt index e565f2398e0..973823d2195 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -26,7 +26,12 @@ CHANGES - Allow to pass None as a timeout value to disable timeout logic #834 -0.21.5 (04-22-2016) +0.21.6 (05-05-2016) +------------------- + +- Drop initial query parameters on redirects #853 + +0.21.5 (03-22-2016) ------------------- - Fix command line arg parsing #797 diff --git a/aiohttp/client.py b/aiohttp/client.py index ec5bd63ebbb..67329103e51 100644 --- a/aiohttp/client.py +++ b/aiohttp/client.py @@ -235,6 +235,7 @@ def _request(self, method, url, *, r_url = urllib.parse.urljoin(url, r_url) url = r_url + params = None yield from resp.release() continue diff --git a/docs/client_reference.rst b/docs/client_reference.rst index 8da3a94d996..df70d396b96 100644 --- a/docs/client_reference.rst +++ b/docs/client_reference.rst @@ -138,7 +138,8 @@ The client session supports the 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: diff --git a/requirements-ci.txt b/requirements-ci.txt index 8fbfb0e3dd0..d3d294b3f27 100644 --- a/requirements-ci.txt +++ b/requirements-ci.txt @@ -1,6 +1,6 @@ pip flake8 -pyflakes>=1.0.0 +pyflakes==1.1.0 coverage sphinx alabaster>=0.6.2 diff --git a/tests/test_client_functional.py b/tests/test_client_functional.py index 8cf5a3ebbcf..7638aa7b195 100644 --- a/tests/test_client_functional.py +++ b/tests/test_client_functional.py @@ -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