(
self,
host: str,
port: int,
method: bytes,
scheme: bytes,
authority: bytes,
path: bytes,
http_version: bytes,
headers: Headers | tuple[tuple[bytes, bytes], ...],
content: bytes | None,
trailers: Headers | tuple[tuple[bytes, bytes], ...] | None,
timestamp_start: float,
timestamp_end: float | None,
)
| 521 | data: RequestData |
| 522 | |
| 523 | def __init__( |
| 524 | self, |
| 525 | host: str, |
| 526 | port: int, |
| 527 | method: bytes, |
| 528 | scheme: bytes, |
| 529 | authority: bytes, |
| 530 | path: bytes, |
| 531 | http_version: bytes, |
| 532 | headers: Headers | tuple[tuple[bytes, bytes], ...], |
| 533 | content: bytes | None, |
| 534 | trailers: Headers | tuple[tuple[bytes, bytes], ...] | None, |
| 535 | timestamp_start: float, |
| 536 | timestamp_end: float | None, |
| 537 | ): |
| 538 | # auto-convert invalid types to retain compatibility with older code. |
| 539 | if isinstance(host, bytes): |
| 540 | host = host.decode("idna", "strict") |
| 541 | if isinstance(method, str): |
| 542 | method = method.encode("ascii", "strict") |
| 543 | if isinstance(scheme, str): |
| 544 | scheme = scheme.encode("ascii", "strict") |
| 545 | if isinstance(authority, str): |
| 546 | authority = authority.encode("ascii", "strict") |
| 547 | if isinstance(path, str): |
| 548 | path = path.encode("ascii", "strict") |
| 549 | if isinstance(http_version, str): |
| 550 | http_version = http_version.encode("ascii", "strict") |
| 551 | |
| 552 | if isinstance(content, str): |
| 553 | raise ValueError(f"Content must be bytes, not {type(content).__name__}") |
| 554 | if not isinstance(headers, Headers): |
| 555 | headers = Headers(headers) |
| 556 | if trailers is not None and not isinstance(trailers, Headers): |
| 557 | trailers = Headers(trailers) |
| 558 | |
| 559 | self.data = RequestData( |
| 560 | host=host, |
| 561 | port=port, |
| 562 | method=method, |
| 563 | scheme=scheme, |
| 564 | authority=authority, |
| 565 | path=path, |
| 566 | http_version=http_version, |
| 567 | headers=headers, |
| 568 | content=content, |
| 569 | trailers=trailers, |
| 570 | timestamp_start=timestamp_start, |
| 571 | timestamp_end=timestamp_end, |
| 572 | ) |
| 573 | |
| 574 | def __repr__(self) -> str: |
| 575 | if self.host and self.port: |
nothing calls this directly
no test coverage detected