remove unused header check
This commit is contained in:
parent
92d756741a
commit
d85ccdf025
1 changed files with 0 additions and 11 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue