1
0
Fork 0

remove unused header check

Zynh Ludwig 2024-08-30 23:15:35 -07:00
parent 92d756741a
commit d85ccdf025
1 changed files with 0 additions and 11 deletions

View File

@ -1,7 +1,6 @@
use axum::{ use axum::{
body::Body, body::Body,
extract::State, extract::State,
http::HeaderMap,
response::{IntoResponse, Redirect}, response::{IntoResponse, Redirect},
routing::get, routing::get,
Router, Router,
@ -17,19 +16,9 @@ pub fn get_download_router() -> Router<AppState> {
async fn download( async fn download(
axum::extract::Path(id): axum::extract::Path<String>, axum::extract::Path(id): axum::extract::Path<String>,
headers: HeaderMap,
State(state): State<AppState>, State(state): State<AppState>,
) -> Result<axum::response::Response, (StatusCode, String)> { ) -> 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; let mut records = state.records.lock().await;
if let Some(record) = records if let Some(record) = records
.get_mut(&id) .get_mut(&id)