From 9decef093dafab20f1caba27f701a109ff7cbe3b Mon Sep 17 00:00:00 2001 From: Lennart <18233294+lennart-k@users.noreply.github.com> Date: Wed, 20 Aug 2025 13:48:50 +0200 Subject: [PATCH] dav: add new http IMPORT method --- crates/dav/src/resource/axum_methods.rs | 8 ++++++++ crates/dav/src/resource/axum_service.rs | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/crates/dav/src/resource/axum_methods.rs b/crates/dav/src/resource/axum_methods.rs index ee01680..638f9ee 100644 --- a/crates/dav/src/resource/axum_methods.rs +++ b/crates/dav/src/resource/axum_methods.rs @@ -38,6 +38,11 @@ pub trait AxumMethods: Sized + Send + Sync + 'static { None } + #[inline] + fn import() -> Option> { + None + } + #[inline] fn allow_header() -> Allow { let mut allow = vec![ @@ -67,6 +72,9 @@ pub trait AxumMethods: Sized + Send + Sync + 'static { if Self::put().is_some() { allow.push(Method::PUT); } + if Self::import().is_some() { + allow.push(Method::from_str("IMPORT").unwrap()); + } allow.into_iter().collect() } diff --git a/crates/dav/src/resource/axum_service.rs b/crates/dav/src/resource/axum_service.rs index 4e602f2..20487b5 100644 --- a/crates/dav/src/resource/axum_service.rs +++ b/crates/dav/src/resource/axum_service.rs @@ -97,6 +97,11 @@ where return svc(self.resource_service.clone(), req); } } + "IMPORT" => { + if let Some(svc) = RS::import() { + return svc(self.resource_service.clone(), req); + } + } _ => {} }; Box::pin(async move {