Rename make_json_response -> json_response.
This commit is contained in:
parent
aa1e2d5756
commit
129eb3f8aa
1 changed files with 4 additions and 2 deletions
|
@ -143,12 +143,14 @@ def gzip_response(request, response):
|
|||
|
||||
return response
|
||||
|
||||
def make_json_response(j, *args, **kwargs):
|
||||
def json_response(j, *args, **kwargs):
|
||||
dumped = json.dumps(j)
|
||||
response = flask.Response(dumped, *args, **kwargs)
|
||||
response.headers['Content-Type'] = 'application/json;charset=utf-8'
|
||||
return response
|
||||
|
||||
make_json_response = json_response
|
||||
|
||||
def required_fields(fields, forbid_whitespace=False):
|
||||
'''
|
||||
Declare that the endpoint requires certain POST body fields. Without them,
|
||||
|
@ -172,7 +174,7 @@ def required_fields(fields, forbid_whitespace=False):
|
|||
'error_type': 'MISSING_FIELDS',
|
||||
'error_message': 'Required fields: %s' % ', '.join(fields),
|
||||
}
|
||||
response = make_json_response(response, status=400)
|
||||
response = json_response(response, status=400)
|
||||
return response
|
||||
return function(*args, **kwargs)
|
||||
return wrapped
|
||||
|
|
Loading…
Reference in a new issue