]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
test that invalid unicode doesn't raise 500
authorMinRK <benjaminrk@gmail.com>
Sun, 22 Dec 2013 06:29:40 +0000 (22:29 -0800)
committerMinRK <benjaminrk@gmail.com>
Mon, 23 Dec 2013 00:34:46 +0000 (16:34 -0800)
tornado/test/web_test.py

index 6136172fc2307ca29f0da1be339ec00be00ac342..f4fa03a66ab52c799a86b179b0fe1808ae1eb7d8 100644 (file)
@@ -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",