Don’t crash on empty content type
This commit is contained in:
parent
132b4856a5
commit
57dde86d8a
1 changed files with 1 additions and 1 deletions
|
@ -9,7 +9,7 @@ class JsonRequestBodyMiddleware:
|
||||||
self.get_response = get_response
|
self.get_response = get_response
|
||||||
|
|
||||||
def __call__(self, request):
|
def __call__(self, request):
|
||||||
is_json = request.META.get('CONTENT_TYPE').lower() == 'application/json'
|
is_json = request.META.get('CONTENT_TYPE', '').lower() == 'application/json'
|
||||||
if is_json:
|
if is_json:
|
||||||
try:
|
try:
|
||||||
request.json_body = json.loads(request.body)
|
request.json_body = json.loads(request.body)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue