Skip to content
Myr

Clarify documentation for json parsing

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Documentation does not currently mention that is_json accepts mimetypes that are not strictly application/json.

authored by Grant Wu · committed by GitHub · parent c7f433c · Browse files · 1 file+5 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−6 removed

  • other:+5 added−6 removed

1 file+5 added−6 removed

modified:flask/wrappers.py+5 added-6 removed
95 unmodified lines
96 return self.url_rule.endpoint.rsplit('.', 1)[0]9798 @property99 def json(self):100 """If the mimetype is :mimetype:`application/json` this will contain the100 """If self.is_json would return true, this will contain the101 parsed JSON data. Otherwise this will be ``None``.102103 The :meth:`get_json` method should be used instead.104 """
18 unmodified lines
123 return False124125 def get_json(self, force=False, silent=False, cache=True):126 """Parses the incoming JSON request data and returns it. By default127 this function will return ``None`` if the mimetype is not128 :mimetype:`application/json` but this can be overridden by the129 ``force`` parameter. If parsing fails the130 :meth:`on_json_loading_failed` method on the request object will be131 invoked.127 this function will return ``None`` if self.is_json would return false,128 but this can be overridden by the ``force`` parameter. If parsing129 fails, the :meth:`on_json_loading_failed` method on the request object130 will be invoked.131132 :param force: if set to ``True`` the mimetype is ignored.133 :param silent: if set to ``True`` this method will fail silently134 and return ``None``.
70 unmodified lines