소스 검색

manage case where response is already HTTPResponse

Bastien Sevajol 6 년 전
부모
커밋
b02be5f3a7
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      hapic/decorator.py

+ 6 - 0
hapic/decorator.py 파일 보기

@@ -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,