Commit da4585fe authored by kaiyou's avatar kaiyou
Browse files

Check JSON without the application type

parent b125b598
Pipeline #941 passed with stage
in 3 minutes and 31 seconds
...@@ -154,7 +154,9 @@ def is_json(f): ...@@ -154,7 +154,9 @@ def is_json(f):
@wraps(f) @wraps(f)
def decorated_function(*args, **kwargs): def decorated_function(*args, **kwargs):
if request.method in ['POST', 'PUT', 'PATCH']: if request.method in ['POST', 'PUT', 'PATCH']:
if not request.is_json: try:
request.get_json(True)
except:
raise RequestIsNotJSON() raise RequestIsNotJSON()
return f(*args, **kwargs) return f(*args, **kwargs)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment