Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix documentation on client address type #2580

Merged
merged 4 commits into from Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/requests.md
Expand Up @@ -60,8 +60,8 @@ For example: `request.path_params['username']`

#### Client Address

The client's remote address is exposed as a named two-tuple `request.client`.
Either item in the tuple may be `None`.
The client's remote address is exposed as a named two-tuple `request.client` (or `None`).
`request.client` may be `None` but each item in the tuple will not be `None`.
julien4215 marked this conversation as resolved.
Show resolved Hide resolved

The hostname or IP address: `request.client.host`

Expand Down
2 changes: 1 addition & 1 deletion starlette/requests.py
Expand Up @@ -145,7 +145,7 @@ def cookies(self) -> dict[str, str]:

@property
def client(self) -> Address | None:
# client is a 2 item tuple of (host, port), None or missing
# client is a 2 item tuple of (host, port), None if missing
host_port = self.scope.get("client")
if host_port is not None:
return Address(*host_port)
Expand Down