From 923e394d0b4dd81213b96039ebe4c66e2efc9c85 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 6 Sep 2020 21:24:50 +0200 Subject: [PATCH] Allow python functions to return a raw HTTPResponse --- moulinette/interfaces/api.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/moulinette/interfaces/api.py b/moulinette/interfaces/api.py index 439cbf2e..7f679c7d 100644 --- a/moulinette/interfaces/api.py +++ b/moulinette/interfaces/api.py @@ -577,6 +577,9 @@ def format_for_response(content): return "" response.status = 200 + if isinstance(content, HTTPResponse): + return content + # Return JSON-style response response.content_type = "application/json" return json_encode(content, cls=JSONExtendedEncoder)