Skip to content

Commit

Permalink
Pass pagination header in tuple rather than in appcontext
Browse files Browse the repository at this point in the history
  • Loading branch information
lafrech committed Feb 24, 2019
1 parent afacc14 commit 6eefc9b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 4 additions & 2 deletions flask_rest_api/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import marshmallow as ma
from webargs.flaskparser import FlaskParser

from .utils import get_appcontext, unpack_tuple_response
from .utils import unpack_tuple_response
from .compat import MARSHMALLOW_VERSION_MAJOR


Expand Down Expand Up @@ -183,7 +183,9 @@ def wrapper(*args, **kwargs):
page_header = self._make_pagination_header(
page_params.page, page_params.page_size,
page_params.item_count)
get_appcontext()['headers'][
if headers is None:
headers = {}
headers[
self.PAGINATION_HEADER_FIELD_NAME] = page_header

return result, status, headers
Expand Down
1 change: 0 additions & 1 deletion flask_rest_api/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def wrapper(*args, **kwargs):

# Build response
resp = jsonify(self._prepare_response_content(result_dump))
resp.headers.extend(appcontext['headers'])
set_status_and_headers_in_response(resp, status, headers)
if status is None:
resp.status_code = code
Expand Down

0 comments on commit 6eefc9b

Please sign in to comment.