Browse Source

small refactoring of is_json function.

pull/2091/head
alexpantyukhin 8 years ago
parent
commit
f6b78843bd
  1. 6
      flask/wrappers.py

6
flask/wrappers.py

@ -116,11 +116,7 @@ class Request(RequestBase):
.. versionadded:: 0.11 .. versionadded:: 0.11
""" """
mt = self.mimetype mt = self.mimetype
if mt == 'application/json': return mt == 'application/json' or mt.startswith('application/') and mt.endswith('+json')
return True
if mt.startswith('application/') and mt.endswith('+json'):
return True
return False
def get_json(self, force=False, silent=False, cache=True): def get_json(self, force=False, silent=False, cache=True):
"""Parses the incoming JSON request data and returns it. By default """Parses the incoming JSON request data and returns it. By default

Loading…
Cancel
Save