remove unused header check

This commit is contained in:
Zynh Ludwig 2024-08-30 23:15:35 -07:00
parent 92d756741a
commit d85ccdf025

View file

@ -1,7 +1,6 @@
use axum::{
body::Body,
extract::State,
http::HeaderMap,
response::{IntoResponse, Redirect},
routing::get,
Router,
@ -17,19 +16,9 @@ pub fn get_download_router() -> Router<AppState> {
async fn download(
axum::extract::Path(id): axum::extract::Path<String>,
headers: HeaderMap,
State(state): State<AppState>,
) -> Result<axum::response::Response, (StatusCode, String)> {
{
if headers.get("hx-request").is_some() {
return Ok(axum::http::Response::builder()
.header("HX-Redirect", format!("/download/{id}"))
.status(204)
.body("".to_owned())
.unwrap()
.into_response());
}
let mut records = state.records.lock().await;
if let Some(record) = records
.get_mut(&id)