Implements `.HTTPConnection.write`. For backwards compatibility it is allowed but deprecated to skip `write_headers` and instead call `write()` with a pre-encoded header block.
(self, chunk: bytes)
| 486 | return chunk |
| 487 | |
| 488 | def write(self, chunk: bytes) -> "Future[None]": |
| 489 | """Implements `.HTTPConnection.write`. |
| 490 | |
| 491 | For backwards compatibility it is allowed but deprecated to |
| 492 | skip `write_headers` and instead call `write()` with a |
| 493 | pre-encoded header block. |
| 494 | """ |
| 495 | future = None |
| 496 | if self.stream.closed(): |
| 497 | future = self._write_future = Future() |
| 498 | self._write_future.set_exception(iostream.StreamClosedError()) |
| 499 | self._write_future.exception() |
| 500 | else: |
| 501 | future = self._write_future = Future() |
| 502 | self._pending_write = self.stream.write(self._format_chunk(chunk)) |
| 503 | future_add_done_callback(self._pending_write, self._on_write_complete) |
| 504 | return future |
| 505 | |
| 506 | def finish(self) -> None: |
| 507 | """Implements `.HTTPConnection.finish`.""" |
no test coverage detected