Merge remote-tracking branch 'norman-labs/branch2.4'
Conflicts: tornado/httputil.py
This commit is contained in:
commit
ae166d7219
|
@ -236,6 +236,8 @@ def parse_body_arguments(content_type, body, arguments, files):
|
||||||
uri_arguments = parse_qs_bytes(native_str(body))
|
uri_arguments = parse_qs_bytes(native_str(body))
|
||||||
for name, values in uri_arguments.items():
|
for name, values in uri_arguments.items():
|
||||||
values = [v for v in values if v]
|
values = [v for v in values if v]
|
||||||
|
uri_arguments = parse_qs_bytes(native_str(body), keep_blank_values=True)
|
||||||
|
for name, values in uri_arguments.items():
|
||||||
if values:
|
if values:
|
||||||
arguments.setdefault(name, []).extend(values)
|
arguments.setdefault(name, []).extend(values)
|
||||||
elif content_type.startswith("multipart/form-data"):
|
elif content_type.startswith("multipart/form-data"):
|
||||||
|
|
|
@ -258,6 +258,8 @@ class EchoHandler(RequestHandler):
|
||||||
def get(self):
|
def get(self):
|
||||||
self.write(recursive_unicode(self.request.arguments))
|
self.write(recursive_unicode(self.request.arguments))
|
||||||
|
|
||||||
|
def post(self):
|
||||||
|
self.write(recursive_unicode(self.request.arguments))
|
||||||
|
|
||||||
class TypeCheckHandler(RequestHandler):
|
class TypeCheckHandler(RequestHandler):
|
||||||
def prepare(self):
|
def prepare(self):
|
||||||
|
@ -316,6 +318,11 @@ class HTTPServerTest(AsyncHTTPTestCase):
|
||||||
data = json_decode(response.body)
|
data = json_decode(response.body)
|
||||||
self.assertEqual(data, {u("foo"): [u(""), u("")]})
|
self.assertEqual(data, {u("foo"): [u(""), u("")]})
|
||||||
|
|
||||||
|
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):
|
def test_types(self):
|
||||||
headers = {"Cookie": "foo=bar"}
|
headers = {"Cookie": "foo=bar"}
|
||||||
response = self.fetch("/typecheck?foo=bar", headers=headers)
|
response = self.fetch("/typecheck?foo=bar", headers=headers)
|
||||||
|
|
Loading…
Reference in New Issue