From bfd2372e6360db13e50f4c971d0fd97ed0787ac6 Mon Sep 17 00:00:00 2001 From: Neil Williams Date: Sat, 22 Sep 2012 23:01:48 -0700 Subject: [PATCH] ErrorController: Send status code even when not rendering. Previously, if the current extension were not in allowed_render_styles, the error's HTTP status code would be swallowed and turned into a 200. This meant that 404ing stylesheets were actually sending back the text "404" as an "OK" stylesheet. --- r2/r2/controllers/error.py | 1 + 1 file changed, 1 insertion(+) diff --git a/r2/r2/controllers/error.py b/r2/r2/controllers/error.py index ae39605b8..19b984c8a 100644 --- a/r2/r2/controllers/error.py +++ b/r2/r2/controllers/error.py @@ -165,6 +165,7 @@ class ErrorController(RedditController): if c.render_style not in self.allowed_render_styles: if code not in (204, 304): c.response.content = str(code) + c.response.status_code = code return c.response elif c.render_style == "api": data = request.environ.get('extra_error_data', {'error': code})