MCPcopy
hub / github.com/urllib3/urllib3 / get_all

Method get_all

src/urllib3/response.py:434–448  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

432 return ret.getvalue()
433
434 def get_all(self) -> bytes:
435 buffer = self.buffer
436 if not buffer:
437 assert self._size == 0
438 return b""
439 if len(buffer) == 1:
440 result = buffer.pop()
441 if isinstance(result, memoryview):
442 result = result.tobytes()
443 else:
444 ret = io.BytesIO()
445 ret.writelines(buffer.popleft() for _ in range(len(buffer)))
446 result = ret.getvalue()
447 self._size = 0
448 return result
449
450
451class BaseHTTPResponse(io.IOBase):

Callers 6

test_get_all_emptyMethod · 0.95
test_get_all_singleMethod · 0.95
test_get_all_manyMethod · 0.95
readMethod · 0.80
read1Method · 0.80

Calls 1

popMethod · 0.80

Tested by 4

test_get_all_emptyMethod · 0.76
test_get_all_singleMethod · 0.76
test_get_all_manyMethod · 0.76