Clarify documentation for json parsing
Documentation does not currently mention that is_json accepts mimetypes that are not strictly application/json.
This commit is contained in:
parent
c7f433c49b
commit
daf85d3725
1 changed files with 5 additions and 6 deletions
|
|
@ -97,7 +97,7 @@ class Request(RequestBase):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def json(self):
|
def json(self):
|
||||||
"""If the mimetype is :mimetype:`application/json` this will contain the
|
"""If self.is_json would return true, this will contain the
|
||||||
parsed JSON data. Otherwise this will be ``None``.
|
parsed JSON data. Otherwise this will be ``None``.
|
||||||
|
|
||||||
The :meth:`get_json` method should be used instead.
|
The :meth:`get_json` method should be used instead.
|
||||||
|
|
@ -124,11 +124,10 @@ class Request(RequestBase):
|
||||||
|
|
||||||
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
|
||||||
this function will return ``None`` if the mimetype is not
|
this function will return ``None`` if self.is_json would return false,
|
||||||
:mimetype:`application/json` but this can be overridden by the
|
but this can be overridden by the ``force`` parameter. If parsing
|
||||||
``force`` parameter. If parsing fails the
|
fails, the :meth:`on_json_loading_failed` method on the request object
|
||||||
:meth:`on_json_loading_failed` method on the request object will be
|
will be invoked.
|
||||||
invoked.
|
|
||||||
|
|
||||||
:param force: if set to ``True`` the mimetype is ignored.
|
:param force: if set to ``True`` the mimetype is ignored.
|
||||||
:param silent: if set to ``True`` this method will fail silently
|
:param silent: if set to ``True`` this method will fail silently
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue