Skip to content

Commit b4a80e2

Browse files
authored
Merge pull request #161 from artezio-andreym/master
check_headers decorator should correctly validate headers
2 parents 57d009d + 9d8d1e4 commit b4a80e2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

flask_rest_jsonapi/decorators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def check_headers(func):
2121
@wraps(func)
2222
def wrapper(*args, **kwargs):
2323
if request.method in ('POST', 'PATCH'):
24-
if 'Content-Type' in request.headers and\
25-
'application/vnd.api+json' in request.headers['Content-Type'] and\
24+
if 'Content-Type' not in request.headers or\
25+
'application/vnd.api+json' not in request.headers['Content-Type'] or\
2626
request.headers['Content-Type'] != 'application/vnd.api+json':
2727
error = json.dumps(jsonapi_errors([{'source': '',
2828
'detail': "Content-Type header must be application/vnd.api+json",

0 commit comments

Comments
 (0)