From 16959423f1aeb48910f57d359782577f02647b29 Mon Sep 17 00:00:00 2001 From: William David Edwards Date: Sun, 16 Feb 2025 11:44:10 +0100 Subject: [PATCH] Use `localhost` instead of `http://localhost` in `TestClient(client=...)` example (#2870) With https://github.com/encode/starlette/pull/2810, it is possible to override the client host (i.e. the remote address; see https://www.starlette.io/requests/#client-address). The default value for `TestClient` is `testclient`, but an IP address in most circumstances. The documentation example for overriding the client host uses a full URI, which makes no sense: it's the remote address. --- docs/testclient.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/testclient.md b/docs/testclient.md index ab05c429..b5e3b5b8 100644 --- a/docs/testclient.md +++ b/docs/testclient.md @@ -86,7 +86,7 @@ By default, the TestClient will set the client host to `"testserver"` and the po You can change the client address by setting the `client` attribute of the `TestClient` instance: ```python -client = TestClient(app, client=('http://localhost', 8000)) +client = TestClient(app, client=('localhost', 8000)) ``` ### Selecting the Async backend -- 2.47.2