From 1c4464096853fcf9de58a7f0b1e7799dbe1f5f20 Mon Sep 17 00:00:00 2001 From: Michele Cella Date: Thu, 28 Apr 2011 03:49:03 -0700 Subject: [PATCH] RequestHandler.get_argument should raise an HTTP 400 Bad Request if the argument is missing, not a misleading HTTP 404 Not Found. --- tornado/web.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tornado/web.py b/tornado/web.py index e32f03bf1..755ccd0a4 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -220,7 +220,7 @@ class RequestHandler(object): """Returns the value of the argument with the given name. If default is not provided, the argument is considered to be - required, and we throw an HTTP 404 exception if it is missing. + required, and we throw an HTTP 400 exception if it is missing. If the argument appears in the url more than once, we return the last value. @@ -230,7 +230,7 @@ class RequestHandler(object): args = self.get_arguments(name, strip=strip) if not args: if default is self._ARG_DEFAULT: - raise HTTPError(404, "Missing argument %s" % name) + raise HTTPError(400, "Missing argument %s" % name) return default return args[-1] -- 2.47.2