From 1c0f4257d1dc5ecc53abe98c7499422c6cf7b052 Mon Sep 17 00:00:00 2001 From: MinRK Date: Sat, 21 Dec 2013 22:29:40 -0800 Subject: [PATCH] test that invalid unicode doesn't raise 500 --- tornado/test/web_test.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tornado/test/web_test.py b/tornado/test/web_test.py index 6136172fc..f4fa03a66 100644 --- a/tornado/test/web_test.py +++ b/tornado/test/web_test.py @@ -586,6 +586,13 @@ class WSGISafeWebTest(WebTestCase): u('query'): [u('bytes'), u('c3a9')], }) + def test_decode_argument_invalid_unicode(self): + # test that invalid unicode in URLs causes 400, not 500 + response = self.fetch("/typecheck/invalid%FF") + self.assertEqual(response.code, 400) + response = self.fetch("/typecheck/invalid?foo=%FF") + self.assertEqual(response.code, 400) + def test_decode_argument_plus(self): # These urls are all equivalent. urls = ["/decode_arg/1%20%2B%201?foo=1%20%2B%201&encoding=utf-8", -- 2.47.2