From 8ec8ccf4fb38e5ceb0c6853f8ad1a0b7110b0fa5 Mon Sep 17 00:00:00 2001 From: Matt Gathu Date: Sat, 22 Feb 2020 16:19:29 +0100 Subject: [PATCH 1/2] Create helper function for HTTP Trace Method Create *route* with `TRACE` method guard. --- src/web.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/web.rs b/src/web.rs index 962c1157b..f47cf865e 100644 --- a/src/web.rs +++ b/src/web.rs @@ -193,6 +193,24 @@ pub fn head() -> Route { method(Method::HEAD) } +/// Create *route* with `TRACE` method guard. +/// +/// ```rust +/// use actix_web::{web, App, HttpResponse}; +/// +/// let app = App::new().service( +/// web::resource("/{project_id}") +/// .route(web::trace().to(|| HttpResponse::Ok())) +/// ); +/// ``` +/// +/// In the above example, one `HEAD` route gets added: +/// * /{project_id} +/// +pub fn trace() -> Route { + method(Method::TRACE) +} + /// Create *route* and add method guard. /// /// ```rust From d143c44130213e43fecc82068c28f33303d9ed98 Mon Sep 17 00:00:00 2001 From: Matt Gathu Date: Sun, 23 Feb 2020 09:33:28 +0100 Subject: [PATCH 2/2] Update the ChangeLog --- CHANGES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index b42635b86..f9cfdf5fa 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,10 @@ ## [2.0.NEXT] - 2020-01-xx +### Added + +* Add helper function for creating routes with `TRACE` method guard `web::trace()` + ### Changed * Use `sha-1` crate instead of unmaintained `sha1` crate