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