Skip to content

Commit

Permalink
Fix Content-Type Access
Browse files Browse the repository at this point in the history
This patch fixes a minor issue where pyCA would end up with an internal
server error in no content type was sent in an API request.
  • Loading branch information
lkiesow committed Dec 13, 2018
1 parent a36f422 commit 2561e03
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pyca/ui/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def decorated(*args, **kwargs):
def jsonapi_mediatype(f):
@wraps(f)
def decorated(*args, **kwargs):
if request.headers['Content-Type'] != 'application/vnd.api+json':
if request.headers.get('Content-Type') != 'application/vnd.api+json':
return Response('Unsupported Media Type', 415)
response = f(*args, **kwargs)
response.headers['Content-Type'] = 'application/vnd.api+json'
Expand Down

0 comments on commit 2561e03

Please sign in to comment.