Fix: Correctly handle unset Content-Type header for command requests

This commit is contained in:
Gina Häußge 2015-09-22 15:23:50 +02:00
parent fd4271a962
commit b4b5689bc4

View file

@ -530,7 +530,8 @@ def get_remote_address(request):
def get_json_command_from_request(request, valid_commands):
if not "application/json" in request.headers["Content-Type"]:
content_type = request.headers.get("Content-Type", None)
if content_type is None or not "application/json" in content_type:
return None, None, make_response("Expected content-type JSON", 400)
data = request.json