Skip to content

Conversation

Turbo87
Copy link
Collaborator

@Turbo87 Turbo87 commented Jan 7, 2025

Motivation

It was previously possible to use Option<Extension<T>> as an extractor, but with axum 0.8 we seem to have lost that functionality.

Solution

This PR implements the OptionalFromRequestParts trait for the Extension wrapper struct, restoring the previous behavior.

The PR also adds a basic test for the extraction behavior, since it seems that we were missing this until now.

@Turbo87 Turbo87 added C-enhancement Category: A PR with an enhancement A-axum labels Jan 7, 2025
@Turbo87 Turbo87 force-pushed the optional-extension branch from 65b1d47 to fda95fb Compare January 7, 2025 17:04
Copy link
Member

@jplatte jplatte left a comment

Choose a reason for hiding this comment

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

Thanks!

@jplatte
Copy link
Member

jplatte commented Jan 7, 2025

(missing changelog entry though)

@Turbo87
Copy link
Collaborator Author

Turbo87 commented Jan 7, 2025

missing changelog entry though

added

@Turbo87 Turbo87 merged commit d07d129 into tokio-rs:main Jan 10, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-axum C-enhancement Category: A PR with an enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants