Browse Source

manage case where response is already HTTPResponse

Bastien Sevajol 6 years ago
parent
commit
b02be5f3a7
1 changed files with 6 additions and 0 deletions
  1. 6 0
      hapic/decorator.py

+ 6 - 0
hapic/decorator.py View File

@@ -3,6 +3,9 @@ import functools
3 3
 import typing
4 4
 from http import HTTPStatus
5 5
 
6
+# TODO BS 20171010: bottle specific !
7
+from bottle import HTTPResponse
8
+
6 9
 from hapic.data import HapicData
7 10
 from hapic.description import ControllerDescription
8 11
 from hapic.exception import ProcessException
@@ -197,6 +200,9 @@ class OutputControllerWrapper(InputOutputControllerWrapper):
197 200
 
198 201
     def after_wrapped_function(self, response: typing.Any) -> typing.Any:
199 202
         try:
203
+            if isinstance(response, HTTPResponse):
204
+                return response
205
+
200 206
             processed_response = self.processor.process(response)
201 207
             prepared_response = self.context.get_response(
202 208
                 processed_response,