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.
This commit is contained in:
parent
aa644b4340
commit
e76b4c1250
1 changed files with 1 additions and 1 deletions
|
|
@ -58,7 +58,7 @@ class BaseResponse(object):
|
||||||
return 200, headers, response
|
return 200, headers, response
|
||||||
else:
|
else:
|
||||||
body, new_headers = response
|
body, new_headers = response
|
||||||
status = new_headers.pop('status', 200)
|
status = new_headers.get('status', 200)
|
||||||
headers.update(new_headers)
|
headers.update(new_headers)
|
||||||
return status, headers, body
|
return status, headers, body
|
||||||
raise NotImplementedError("The {0} action has not been implemented".format(action))
|
raise NotImplementedError("The {0} action has not been implemented".format(action))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue