MCPcopy
hub / github.com/aio-libs/aiohttp / decode

Method decode

aiohttp/multipart.py:435–455  ·  view source on GitHub ↗

Decodes data according the specified `Content-Encoding` or `Content-Transfer-Encoding` headers value. Supports ``gzip``, ``deflate`` and ``identity`` encodings for `Content-Encoding` header. Supports ``base64``, ``quoted-printable`` encodings for `Content-Tr

(self, data)

Source from the content-addressed store, hash-verified

433 return self._at_eof
434
435 def decode(self, data):
436 """Decodes data according the specified `Content-Encoding`
437 or `Content-Transfer-Encoding` headers value.
438
439 Supports ``gzip``, ``deflate`` and ``identity`` encodings for
440 `Content-Encoding` header.
441
442 Supports ``base64``, ``quoted-printable`` encodings for
443 `Content-Transfer-Encoding` header.
444
445 :param bytearray data: Data to decode.
446
447 :raises: :exc:`RuntimeError` - if encoding is unknown.
448
449 :rtype: bytes
450 """
451 if CONTENT_TRANSFER_ENCODING in self.headers:
452 data = self._decode_content_transfer(data)
453 if CONTENT_ENCODING in self.headers:
454 return self._decode_content(data)
455 return data
456
457 def _decode_content(self, data):
458 encoding = self.headers[CONTENT_ENCODING].lower()

Callers 15

readMethod · 0.95
getChildMethod · 0.80
_ws_connectMethod · 0.80
__init__Method · 0.80
textMethod · 0.80
textMethod · 0.80
update_hostMethod · 0.80
textMethod · 0.80
jsonMethod · 0.80
encodeMethod · 0.80
_responseMethod · 0.80
parse_headersMethod · 0.80

Calls 2

_decode_contentMethod · 0.95

Tested by 15

_responseMethod · 0.64
setUpMethod · 0.64
test_render_with_bodyFunction · 0.64
gen_ws_headersFunction · 0.64
test_protocol_keyFunction · 0.64
test_handshakeFunction · 0.64
connect_wsMethod · 0.64
test_use_global_loopMethod · 0.64