Skip to content

Conversation

iudeen
Copy link
Contributor

@iudeen iudeen commented Dec 26, 2024

Summary

Fixes #2295

Added client and port parameter to TestClient

Copy link
Collaborator

@Kludex Kludex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the "how to test", just see the test_testclient.py, and add an entry with a different client, and check the scope["client"] on the endpoint.

@iudeen iudeen marked this pull request as ready for review December 26, 2024 09:02
@iudeen iudeen requested a review from Kludex December 26, 2024 09:02
@iudeen iudeen changed the title fix: add client as paramter to TestClient feat: add client as paramter to TestClient Dec 26, 2024
@Kludex Kludex changed the title feat: add client as paramter to TestClient Add client parameter to TestClient Dec 26, 2024
@Kludex
Copy link
Collaborator

Kludex commented Dec 28, 2024

Thanks! :)

@Kludex Kludex enabled auto-merge (squash) December 28, 2024 04:56
@Kludex Kludex merged commit 2006662 into encode:master Dec 28, 2024
6 checks passed
WilliamDEdwards added a commit to WilliamDEdwards/starlette that referenced this pull request Feb 15, 2025
With encode#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.
Kludex pushed a commit that referenced this pull request Feb 16, 2025
…..)` 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.
github-actions bot pushed a commit to Kludex/jik that referenced this pull request Feb 17, 2025
…..)` example (#2870)

With encode/starlette#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

invalid format of client's host in testclient
2 participants