]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Update structure.rst 2210/head
authorhipro <luanshome@gmail.com>
Fri, 8 Dec 2017 09:43:12 +0000 (17:43 +0800)
committerGitHub <noreply@github.com>
Fri, 8 Dec 2017 09:43:12 +0000 (17:43 +0800)
docs/guide/structure.rst

index b0735a17f5f1883a95199b540d827c11a385f95d..e9f9506c0b5d2d610707aec19bb6a64905877763 100644 (file)
@@ -165,7 +165,7 @@ of form-encoding may override `~.RequestHandler.prepare` to parse their
 requests::
 
     def prepare(self):
-        if self.request.headers["Content-Type"].startswith("application/json"):
+        if self.request.headers.get("Content-Type", "").startswith("application/json"):
             self.json_args = json.loads(self.request.body)
         else:
             self.json_args = None