From e76b4c1250c2b4fd72940d3a8e2fd0a1bdbde7c1 Mon Sep 17 00:00:00 2001 From: Ilya Sukhanov Date: Tue, 15 Apr 2014 20:46:17 -0400 Subject: [PATCH] Fix: Preseve status code in header when != 200 before: reply: 'HTTP/1.1 400 Bad Request\n' header: date: Wed, 16 Apr 2014 00:30:07 GMT header: content-type: text/plain; charset=utf-8 header: content-length: 286 header: server: Python/HTTPretty header: status: 200 header: connection: close after: reply: 'HTTP/1.1 400 Bad Request\n' header: date: Wed, 16 Apr 2014 00:32:45 GMT header: content-type: text/plain; charset=utf-8 header: content-length: 286 header: server: Python/HTTPretty header: status: 400 header: connection: close Note how status and reply http did not match before but do now. --- moto/core/responses.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moto/core/responses.py b/moto/core/responses.py index 88e4ea6df..8e6c5bfcc 100644 --- a/moto/core/responses.py +++ b/moto/core/responses.py @@ -58,7 +58,7 @@ class BaseResponse(object): return 200, headers, response else: body, new_headers = response - status = new_headers.pop('status', 200) + status = new_headers.get('status', 200) headers.update(new_headers) return status, headers, body raise NotImplementedError("The {0} action has not been implemented".format(action))