|
1 | 1 | # coding: utf8
|
2 | 2 | from __future__ import unicode_literals
|
3 | 3 | from flask import request, Flask, Blueprint
|
4 |
| -from flask._compat import reraise, string_types, text_type |
| 4 | +from flask._compat import reraise, string_types |
5 | 5 | from flask_api.exceptions import APIException
|
6 | 6 | from flask_api.request import APIRequest
|
7 | 7 | from flask_api.response import APIResponse
|
@@ -55,13 +55,15 @@ def make_response(self, rv):
|
55 | 55 | headers, status_or_headers = status_or_headers, None
|
56 | 56 |
|
57 | 57 | if not isinstance(rv, self.response_class):
|
58 |
| - if isinstance(rv, (text_type, bytes, bytearray, list, dict)): |
| 58 | + if isinstance(rv, self.response_class.api_return_types): |
59 | 59 | status = status_or_headers
|
60 | 60 | rv = self.response_class(rv, headers=headers, status=status)
|
61 | 61 | headers = status_or_headers = None
|
62 | 62 | else:
|
63 | 63 | rv = self.response_class.force_type(rv, request.environ)
|
64 | 64 |
|
| 65 | + if status_or_headers is not None: |
| 66 | + if isinstance( |
65 | 67 | if status_or_headers is not None:
|
66 | 68 | if isinstance(status_or_headers, string_types):
|
67 | 69 | rv.status = status_or_headers
|
|
0 commit comments