8000 Add `client` parameter to `TestClient` by iudeen · Pull Request #2810 · encode/starlette · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add client parameter to TestClient #2810

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

Merged
merged 12 commits into from
Dec 28, 2024

Conversation

iudeen
Copy link
Contributor
@iudeen iudeen commented Dec 26, 2024

Summary

Fixes #2295

Added client and port parameter to TestClient

Copy link
Member
@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
Member
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
0