Skip to content

Commit fb9982f

Browse files
authored
oidc: Use the correct types to compare the status codes in the oidc example (#3363)
1 parent 856dd01 commit fb9982f

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/oidc_cli/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ anyhow = "1"
1313
axum = "0.7.4"
1414
dirs = "5.0.1"
1515
futures-util = { version = "0.3.21", default-features = false }
16-
http = "1.1.0"
1716
matrix-sdk-ui = { path = "../../crates/matrix-sdk-ui" }
1817
rand = { workspace = true }
1918
serde = { workspace = true }

examples/oidc_cli/src/main.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ use std::{
2323
};
2424

2525
use anyhow::{anyhow, bail};
26-
use axum::{response::IntoResponse, routing::any_service};
26+
use axum::{
27+
http::{Method, Request, StatusCode},
28+
response::IntoResponse,
29+
routing::any_service,
30+
};
2731
use futures_util::StreamExt;
28-
use http::{Method, StatusCode};
2932
use matrix_sdk::{
3033
config::SyncSettings,
3134
oidc::{
@@ -681,10 +684,9 @@ async fn build_client(data_dir: &Path) -> anyhow::Result<(Client, ClientSession,
681684
));
682685
}
683686
Err(error) => {
684-
if error
685-
.as_client_api_error()
686-
.is_some_and(|err| err.status_code == StatusCode::NOT_FOUND)
687-
{
687+
if error.as_client_api_error().is_some_and(|err| {
688+
err.status_code == matrix_sdk::reqwest::StatusCode::NOT_FOUND
689+
}) {
688690
println!("This homeserver doesn't advertise an authentication issuer.");
689691
} else {
690692
println!("Error fetching the authentication issuer: {error:?}");
@@ -839,7 +841,7 @@ async fn spawn_local_server(
839841
};
840842

841843
// Set up the server.
842-
let router = any_service(service_fn(move |request: http::Request<_>| {
844+
let router = any_service(service_fn(move |request: Request<_>| {
843845
let data_tx_mutex = data_tx_mutex.clone();
844846
async move {
845847
// Reject methods others than HEAD or GET.

0 commit comments

Comments
 (0)