MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / json

Method json

thirdparty/bottle/bottle.py:1667–1683  ·  view source on GitHub ↗

If the ``Content-Type`` header is ``application/json`` or ``application/json-rpc``, this property holds the parsed content of the request body. Only requests smaller than :attr:`MEMFILE_MAX` are processed to avoid memory exhaustion. Invalid JSON raise

(self)

Source from the content-addressed store, hash-verified

1665
1666 @DictProperty('environ', 'bottle.request.json', read_only=True)
1667 def json(self):
1668 """ If the ``Content-Type`` header is ``application/json`` or
1669 ``application/json-rpc``, this property holds the parsed content
1670 of the request body. Only requests smaller than :attr:`MEMFILE_MAX`
1671 are processed to avoid memory exhaustion.
1672 Invalid JSON raises a 400 error response.
1673 """
1674 ctype = self.environ.get('CONTENT_TYPE', '').lower().split(';')[0]
1675 if ctype in ('application/json', 'application/json-rpc'):
1676 b = self._get_body_string(self.MEMFILE_MAX)
1677 if not b:
1678 return None
1679 try:
1680 return json_loads(b)
1681 except (ValueError, TypeError):
1682 raise HTTPError(400, 'Invalid JSON')
1683 return None
1684
1685 def _iter_body(self, read, bufsize):
1686 maxread = max(0, self.content_length)

Callers

nothing calls this directly

Calls 3

_get_body_stringMethod · 0.95
HTTPErrorClass · 0.70
getMethod · 0.45

Tested by

no test coverage detected