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