elif content_type == 'application/json':
try:
request_json = json.loads(request.body.decode())
assert isinstance(request_json, dict)
return request_json
except:
raise HttpError(HttpResponseBadRequest('POST body sent invalid JSON.'))
i believe this code should be refactored