mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-05 14:35:20 -04:00
oidc: Use the correct types to compare the status codes in the oidc example (#3363)
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -1689,7 +1689,6 @@ dependencies = [
|
||||
"axum 0.7.4",
|
||||
"dirs",
|
||||
"futures-util",
|
||||
"http 1.1.0",
|
||||
"matrix-sdk",
|
||||
"matrix-sdk-ui",
|
||||
"rand",
|
||||
|
||||
@@ -13,7 +13,6 @@ anyhow = "1"
|
||||
axum = "0.7.4"
|
||||
dirs = "5.0.1"
|
||||
futures-util = { version = "0.3.21", default-features = false }
|
||||
http = "1.1.0"
|
||||
matrix-sdk-ui = { path = "../../crates/matrix-sdk-ui" }
|
||||
rand = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
|
||||
@@ -23,9 +23,12 @@ use std::{
|
||||
};
|
||||
|
||||
use anyhow::{anyhow, bail};
|
||||
use axum::{response::IntoResponse, routing::any_service};
|
||||
use axum::{
|
||||
http::{Method, Request, StatusCode},
|
||||
response::IntoResponse,
|
||||
routing::any_service,
|
||||
};
|
||||
use futures_util::StreamExt;
|
||||
use http::{Method, StatusCode};
|
||||
use matrix_sdk::{
|
||||
config::SyncSettings,
|
||||
oidc::{
|
||||
@@ -681,10 +684,9 @@ async fn build_client(data_dir: &Path) -> anyhow::Result<(Client, ClientSession,
|
||||
));
|
||||
}
|
||||
Err(error) => {
|
||||
if error
|
||||
.as_client_api_error()
|
||||
.is_some_and(|err| err.status_code == StatusCode::NOT_FOUND)
|
||||
{
|
||||
if error.as_client_api_error().is_some_and(|err| {
|
||||
err.status_code == matrix_sdk::reqwest::StatusCode::NOT_FOUND
|
||||
}) {
|
||||
println!("This homeserver doesn't advertise an authentication issuer.");
|
||||
} else {
|
||||
println!("Error fetching the authentication issuer: {error:?}");
|
||||
@@ -839,7 +841,7 @@ async fn spawn_local_server(
|
||||
};
|
||||
|
||||
// Set up the server.
|
||||
let router = any_service(service_fn(move |request: http::Request<_>| {
|
||||
let router = any_service(service_fn(move |request: Request<_>| {
|
||||
let data_tx_mutex = data_tx_mutex.clone();
|
||||
async move {
|
||||
// Reject methods others than HEAD or GET.
|
||||
|
||||
Reference in New Issue
Block a user