]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Remove HTTP method check from HTTPServerRequest._parse_body.
authorBen Darnell <ben@bendarnell.com>
Sun, 25 May 2014 15:39:12 +0000 (11:39 -0400)
committerBen Darnell <ben@bendarnell.com>
Sun, 25 May 2014 15:39:12 +0000 (11:39 -0400)
The semantics of a body are not well-defined for some methods,
but if a client sends a body with the correct content-type,
we might as well parse it no matter what the method.

Closes #1011.

tornado/httputil.py

index 077fdc2f920012ef54ca0ed01c8204494eb39a41..6e110d9035b1058529e052bf083a94724cb7b9de 100644 (file)
@@ -430,14 +430,13 @@ class HTTPServerRequest(object):
             return None
 
     def _parse_body(self):
-        if self.method in ("POST", "PATCH", "PUT"):
-            parse_body_arguments(
-                self.headers.get("Content-Type", ""), self.body,
-                self.body_arguments, self.files,
-                self.headers)
-
-            for k, v in self.body_arguments.items():
-                self.arguments.setdefault(k, []).extend(v)
+        parse_body_arguments(
+            self.headers.get("Content-Type", ""), self.body,
+            self.body_arguments, self.files,
+            self.headers)
+
+        for k, v in self.body_arguments.items():
+            self.arguments.setdefault(k, []).extend(v)
 
     def __repr__(self):
         attrs = ("protocol", "host", "method", "uri", "version", "remote_ip")