Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Commit a20939c

Browse files
committed
bug fix
1 parent 9d533a2 commit a20939c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

flask_rest_jsonapi/decorators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ def wrapper(*args, **kwargs):
2929
if 'Accept' in request.headers:
3030
flag = False
3131
for accept in request.headers['Accept'].split(','):
32-
if accept == 'application/vnd.api+json':
32+
if accept.strip() == 'application/vnd.api+json':
3333
flag = False
3434
break
35-
if 'application/vnd.api+json' in accept and accept != 'application/vnd.api+json':
35+
if 'application/vnd.api+json' in accept and accept.strip() != 'application/vnd.api+json':
3636
flag = True
3737
if flag is True:
3838
error = jsonify(jsonapi_errors([{'source': '',

tests/test_sqlalchemy_data_layer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ def test_wrong_accept_header(client, register_routes):
754754
# test Content-Type error
755755
def test_wrong_content_type(client, register_routes):
756756
with client:
757-
response = client.post('/persons')
757+
response = client.post('/persons', headers={'Content-Type': 'application/vnd.api+json;q=0.8'})
758758
assert response.status_code == 415
759759

760760

0 commit comments

Comments
 (0)