MCPcopy Index your code
hub / github.com/fluentpython/example-code-2e / _get_body_string

Method _get_body_string

21-async/mojifinder/bottle.py:1184–1194  ·  view source on GitHub ↗

read body until content-length or MEMFILE_MAX into a string. Raise HTTPError(413) on requests that are to large.

(self)

Source from the content-addressed store, hash-verified

1182 return body
1183
1184 def _get_body_string(self):
1185 ''' read body until content-length or MEMFILE_MAX into a string. Raise
1186 HTTPError(413) on requests that are to large. '''
1187 clen = self.content_length
1188 if clen > self.MEMFILE_MAX:
1189 raise HTTPError(413, 'Request to large')
1190 if clen < 0: clen = self.MEMFILE_MAX + 1
1191 data = self.body.read(clen)
1192 if len(data) > self.MEMFILE_MAX: # Fail fast
1193 raise HTTPError(413, 'Request to large')
1194 return data
1195
1196 @property
1197 def body(self):

Callers 2

jsonMethod · 0.95
POSTMethod · 0.95

Calls 2

HTTPErrorClass · 0.85
readMethod · 0.80

Tested by

no test coverage detected