Skip to content

Commit 1695942

Browse files
Use localhost instead of http://localhost in TestClient(client=...) example (#2870)
With #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.
1 parent a7d0b14 commit 1695942

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/testclient.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ By default, the TestClient will set the client host to `"testserver"` and the po
8686
You can change the client address by setting the `client` attribute of the `TestClient` instance:
8787

8888
```python
89-
client = TestClient(app, client=('http://localhost', 8000))
89+
client = TestClient(app, client=('localhost', 8000))
9090
```
9191

9292
### Selecting the Async backend

0 commit comments

Comments
 (0)