Skip to content

Commit

Permalink
Fix documentation on client address type (encode#2580)
Browse files Browse the repository at this point in the history
  • Loading branch information
julien4215 authored and Rocky Allen committed Jul 20, 2024
1 parent 29c5bd3 commit 90b0cbd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions docs/requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ 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`).

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

Expand Down
2 changes: 1 addition & 1 deletion starlette/requests.py
Original file line number Diff line number Diff line change
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

0 comments on commit 90b0cbd

Please sign in to comment.