Skip to content

Commit

Permalink
Merge pull request #1784 from iceb0y/fix-empty-form-values2
Browse files Browse the repository at this point in the history
keep blank values while parsing form (#1765)
  • Loading branch information
fafhrd91 authored Apr 4, 2017
2 parents 4ae8802 + 2f8a231 commit 0bf3985
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ Changes
=======


2.0.6 (2017-04-xx)
------------------

- Keeping blank values for `request.post()` #1765


2.0.5 (2017-03-29)
------------------

Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Kirill Malovitsa
Kyrylo Perevozchikov
Lars P. Søndergaard
Louis-Philippe Huberdeau
Lu Gong
Lubomir Gelo
Ludovic Gasc
Lukasz Marcin Dobrzanski
Expand Down
1 change: 1 addition & 0 deletions aiohttp/web_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ def post(self):
out.extend(
parse_qsl(
data.rstrip().decode(charset),
keep_blank_values=True,
encoding=charset))

self._post = MultiDictProxy(out)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_web_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ def test_post_form(loop, test_client):
@asyncio.coroutine
def handler(request):
data = yield from request.post()
assert {'a': '1', 'b': '2'} == data
assert {'a': '1', 'b': '2', 'c': ''} == data
return web.Response(body=b'OK')

app = web.Application()
app.router.add_post('/', handler)
client = yield from test_client(app)

resp = yield from client.post('/', data={'a': 1, 'b': 2})
resp = yield from client.post('/', data={'a': 1, 'b': 2, 'c': ''})
assert 200 == resp.status
txt = yield from resp.text()
assert 'OK' == txt
Expand Down

0 comments on commit 0bf3985

Please sign in to comment.