Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
akira-dev committed Nov 22, 2017
1 parent 9d533a2 commit a20939c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions flask_rest_jsonapi/decorators.py
Expand Up @@ -29,10 +29,10 @@ def wrapper(*args, **kwargs):
if 'Accept' in request.headers:
flag = False
for accept in request.headers['Accept'].split(','):
if accept == 'application/vnd.api+json':
if accept.strip() == 'application/vnd.api+json':
flag = False
break
if 'application/vnd.api+json' in accept and accept != 'application/vnd.api+json':
if 'application/vnd.api+json' in accept and accept.strip() != 'application/vnd.api+json':
flag = True
if flag is True:
error = jsonify(jsonapi_errors([{'source': '',
Expand Down
2 changes: 1 addition & 1 deletion tests/test_sqlalchemy_data_layer.py
Expand Up @@ -754,7 +754,7 @@ def test_wrong_accept_header(client, register_routes):
# test Content-Type error
def test_wrong_content_type(client, register_routes):
with client:
response = client.post('/persons')
response = client.post('/persons', headers={'Content-Type': 'application/vnd.api+json;q=0.8'})
assert response.status_code == 415


Expand Down

0 comments on commit a20939c

Please sign in to comment.