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

Commit 60b6691

Browse files
authored
Merge pull request #24 from tejinderss/master
Checking if Content-Type is present in the request headers
2 parents 40d8714 + 4f60803 commit 60b6691

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

flask_rest_jsonapi/decorators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def check_headers(func):
1717
@wraps(func)
1818
def wrapped(*args, **kwargs):
1919
if request.method in ('POST', 'PATCH'):
20-
if request.headers['Content-Type'] != 'application/vnd.api+json':
20+
if 'Content-Type' not in request.headers or request.headers['Content-Type'] != 'application/vnd.api+json':
2121
error = json.dumps(jsonapi_errors([{'source': '',
2222
'detail': "Content-Type header must be application/vnd.api+json",
2323
'title': 'InvalidRequestHeader',

0 commit comments

Comments
 (0)