MCPcopy
hub / github.com/cherrypy/cherrypy / json_processor

Function json_processor

cherrypy/lib/jsontools.py:6–13  ·  view source on GitHub ↗

Read application/json data into request.json.

(entity)

Source from the content-addressed store, hash-verified

4
5
6def json_processor(entity):
7 """Read application/json data into request.json."""
8 if not entity.headers.get(ntou('Content-Length'), ntou('')):
9 raise cherrypy.HTTPError(411)
10
11 body = entity.fp.read()
12 with cherrypy.HTTPError.handle(ValueError, 400, 'Invalid JSON document'):
13 cherrypy.serving.request.json = json.decode(body.decode('utf-8'))
14
15
16def json_in(content_type=[ntou('application/json'), ntou('text/javascript')],

Callers

nothing calls this directly

Calls 4

ntouFunction · 0.90
getMethod · 0.45
readMethod · 0.45
handleMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…