Implement nonfunctional COPY and MOVE method

Fixes #69 for now
This commit is contained in:
Lennart
2025-06-10 17:42:03 +02:00
parent 103ac0b1f9
commit 32225bdda8
7 changed files with 112 additions and 28 deletions

View File

@@ -1,4 +1,8 @@
use axum::{body::Body, extract::FromRequestParts, response::IntoResponse};
use axum::{
body::Body,
extract::{FromRequestParts, OptionalFromRequestParts},
response::IntoResponse,
};
use rustical_xml::{ValueDeserialize, ValueSerialize, XmlError};
use thiserror::Error;
@@ -59,6 +63,21 @@ impl TryFrom<&[u8]> for Depth {
}
}
impl<S: Send + Sync> OptionalFromRequestParts<S> for Depth {
type Rejection = InvalidDepthHeader;
async fn from_request_parts(
parts: &mut axum::http::request::Parts,
_state: &S,
) -> Result<Option<Self>, Self::Rejection> {
if let Some(depth_header) = parts.headers.get("Depth") {
Ok(Some(depth_header.as_bytes().try_into()?))
} else {
Ok(None)
}
}
}
impl<S: Send + Sync> FromRequestParts<S> for Depth {
type Rejection = InvalidDepthHeader;