From 4eab23e224873350ccc3454b19f3430b11fb98bf Mon Sep 17 00:00:00 2001 From: Chaim Lukas Maier Date: Thu, 17 Oct 2024 10:18:03 +0200 Subject: [PATCH] Add PATCH method to Actix router builder --- oasgen/src/server/actix.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/oasgen/src/server/actix.rs b/oasgen/src/server/actix.rs index 56063af..8e33315 100644 --- a/oasgen/src/server/actix.rs +++ b/oasgen/src/server/actix.rs @@ -93,6 +93,22 @@ impl Server { )); self } + + pub fn patch(mut self, path: &str, handler: F) -> Self + where + F: Handler + Copy + Send, + Args: FromRequest + 'static, + F::Output: Responder + 'static, + >::Output: OaParameter, + { + self.add_handler_to_spec(path, http::Method::PATCH, &handler); + self.router.0.push(build_inner_resource( + path.to_string(), + Method::PATCH, + handler, + )); + self + } } impl Server> {