human
I wrote the below code

    @wraps(view_function)
    def parse_json_into_request(request, *args, **kwargs):
        if (('application/json' in request.META.get('CONTENT_TYPE', '')) and request.body):
            try:
                request.json = json.loads(request.body)
            except ValueError:
                return JsonResponseBadRequest({'error': 'Invalid    JSON'})
        else:
            request.json = {}
        return view_function(request, *args, **kwargs)
    return parse_json_into_request

What's a good function header?
assistant
#Here's a good function header.

def expect_json(view_function):