Refactor test suite to handle 303 See Other

This commit is contained in:
Alphonse Paix
2025-09-18 20:42:50 +02:00
parent 3120c700a4
commit 71d4872878
4 changed files with 16 additions and 17 deletions

View File

@@ -11,10 +11,7 @@ use axum::{
extract::State,
response::{Html, IntoResponse, Response},
};
use axum::{
http::{HeaderMap, StatusCode},
response::Redirect,
};
use axum::{http::StatusCode, response::Redirect};
use secrecy::SecretString;
#[derive(thiserror::Error)]
@@ -117,9 +114,11 @@ pub async fn post_login(
.await
.map_err(|e| LoginError::UnexpectedError(e.into()))?;
let mut headers = HeaderMap::new();
headers.insert("HX-Redirect", "/admin/dashboard".parse().unwrap());
Ok((StatusCode::OK, headers).into_response())
let mut response = Redirect::to("/admin/dashboard").into_response();
response
.headers_mut()
.insert("HX-Redirect", "/admin/dashboard".parse().unwrap());
Ok(response)
}
}
}