Allow python functions to return a raw HTTPResponse

This commit is contained in:
Alexandre Aubin 2020-09-06 21:24:50 +02:00
parent 5feddfa93a
commit 923e394d0b

View file

@ -577,6 +577,9 @@ def format_for_response(content):
return "" return ""
response.status = 200 response.status = 200
if isinstance(content, HTTPResponse):
return content
# Return JSON-style response # Return JSON-style response
response.content_type = "application/json" response.content_type = "application/json"
return json_encode(content, cls=JSONExtendedEncoder) return json_encode(content, cls=JSONExtendedEncoder)