Skip to content

Commit

Permalink
Merge pull request #307 from geoadmin/bugfix_BGDIINF_SB-1898_key_error
Browse files Browse the repository at this point in the history
BGDIINF_SB-1898: Avoid crash if request is missing the content-type header.
  • Loading branch information
ltshb authored Jul 9, 2021
2 parents 94d9af3 + 295d007 commit ad9129a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/stac_api/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def custom_exception_handler(exc, context):

if (
context['request']._request.method.upper() in ["PATCH", "POST", "PUT"] and
'application/json' in context['request']._request.headers['content-type'].lower()
'application/json' in context['request']._request.headers.get('content-type',
'').lower()
):
extra["request.payload"] = context['request'].data

Expand Down

0 comments on commit ad9129a

Please sign in to comment.