Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: tokio-rs/axum
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 65b1d4772fa5de31625b7e05026bc8a5face64c6
Choose a base ref
..
head repository: tokio-rs/axum
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fda95fbe3b3f265d80daaa9f760ea0764500d25d
Choose a head ref
Showing with 3 additions and 3 deletions.
  1. +3 −3 axum/src/extension.rs
6 changes: 3 additions & 3 deletions axum/src/extension.rs
Original file line number Diff line number Diff line change
@@ -204,23 +204,23 @@ mod tests {
}

async fn optional_foo(extension: Option<Extension<Foo>>) -> String {
extension.map(|foo| foo.0 .0).unwrap_or("none".to_string())
extension.map(|foo| foo.0 .0).unwrap_or("none".to_owned())
}

async fn requires_bar(Extension(bar): Extension<Bar>) -> String {
bar.0
}

async fn optional_bar(extension: Option<Extension<Bar>>) -> String {
extension.map(|bar| bar.0 .0).unwrap_or("none".to_string())
extension.map(|bar| bar.0 .0).unwrap_or("none".to_owned())
}

let app = Router::new()
.route("/requires_foo", get(requires_foo))
.route("/optional_foo", get(optional_foo))
.route("/requires_bar", get(requires_bar))
.route("/optional_bar", get(optional_bar))
.layer(Extension(Foo("foo".to_string())));
.layer(Extension(Foo("foo".to_owned())));

let client = TestClient::new(app);