Skip to content
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

Simplify TestClient implementation #3096

Merged
merged 3 commits into from
Dec 23, 2024
Merged

Conversation

Turbo87
Copy link
Collaborator

@Turbo87 Turbo87 commented Dec 23, 2024

Motivation

While working on some other stuff, I noticed that the TestClient implementation in the axum crate could be simplified a little bit …

Solution

… by taking advantage of the Deref trait.

This makes it possible to access all methods of the inner `response` field directly.
This returns the same as the `status()` fn of the inner `response`, so we might as well take advantage of the `Deref` implementation.
This returns essentially the same as the `headers()` fn of the inner `response`, so we might as well take advantage of the `Deref` implementation. This also avoids unnecessary cloning.
@jplatte jplatte merged commit f476b31 into tokio-rs:main Dec 23, 2024
18 checks passed
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.

2 participants