Can you use the `JsonResponse` class from `util.json_request`? It sets a bunch of sensible defaults for you, including the content-type for application/json. Also, set the response status code to 400 to indicate that there was an error with the request.