that will be updated with the parsed contents.
"""
if content_type.startswith("application/x-www-form-urlencoded"):
- uri_arguments = parse_qs_bytes(native_str(body))
+ uri_arguments = parse_qs_bytes(native_str(body), keep_blank_values=True)
for name, values in uri_arguments.iteritems():
- values = [v for v in values if v]
if values:
arguments.setdefault(name, []).extend(values)
elif content_type.startswith("multipart/form-data"):
def get(self):
self.write(recursive_unicode(self.request.arguments))
+ def post(self):
+ self.write(recursive_unicode(self.request.arguments))
class TypeCheckHandler(RequestHandler):
def prepare(self):
data = json_decode(response.body)
self.assertEqual(data, {u"foo": [u"\u00e9"]})
+ def test_empty_post_parameters(self):
+ response = self.fetch("/echo", method="POST", body="foo=&bar=")
+ data = json_decode(response.body)
+ self.assertEqual(data, {u"foo": [u""], u"bar": [u""]})
+
def test_types(self):
headers = {"Cookie": "foo=bar"}
response = self.fetch("/typecheck?foo=bar", headers=headers)