diff --git a/src/lib.rs b/src/lib.rs index 6e809fb65..a61387e81 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -27,7 +27,7 @@ pub use actix_web_codegen::*; // re-export for convenience pub use actix_http::Response as HttpResponse; -pub use actix_http::{body, error, http, Error, HttpMessage, ResponseError, Result}; +pub use actix_http::{error, http, Error, HttpMessage, ResponseError, Result}; pub use crate::app::App; pub use crate::extract::FromRequest; @@ -154,37 +154,42 @@ pub mod web { Scope::new(path) } - /// Create **route** without configuration. + /// Create *route* without configuration. pub fn route() -> Route

{ Route::new() } - /// Create **route** with `GET` method guard. + /// Create *route* with `GET` method guard. pub fn get() -> Route

{ - Route::get() + Route::new().method(Method::GET) } - /// Create **route** with `POST` method guard. + /// Create *route* with `POST` method guard. pub fn post() -> Route

{ - Route::post() + Route::new().method(Method::POST) } - /// Create **route** with `PUT` method guard. + /// Create *route* with `PUT` method guard. pub fn put() -> Route

{ - Route::put() + Route::new().method(Method::PUT) } - /// Create **route** with `DELETE` method guard. + /// Create *route* with `PATCH` method guard. + pub fn patch() -> Route

{ + Route::new().method(Method::PATCH) + } + + /// Create *route* with `DELETE` method guard. pub fn delete() -> Route

{ - Route::delete() + Route::new().method(Method::DELETE) } - /// Create **route** with `HEAD` method guard. + /// Create *route* with `HEAD` method guard. pub fn head() -> Route

{ Route::new().method(Method::HEAD) } - /// Create **route** and add method guard. + /// Create *route* and add method guard. pub fn method(method: Method) -> Route

{ Route::new().method(method) } diff --git a/src/responder.rs b/src/responder.rs index 9e9e0f109..6dce300a6 100644 --- a/src/responder.rs +++ b/src/responder.rs @@ -291,7 +291,7 @@ mod tests { use actix_service::Service; use bytes::Bytes; - use crate::body::{Body, ResponseBody}; + use crate::dev::{Body, ResponseBody}; use crate::http::StatusCode; use crate::test::{init_service, TestRequest}; use crate::{web, App}; diff --git a/src/route.rs b/src/route.rs index d1a8320d9..f7b99050e 100644 --- a/src/route.rs +++ b/src/route.rs @@ -60,26 +60,6 @@ impl Route

{ } } - /// Create new `GET` route. - pub fn get() -> Route

{ - Route::new().method(Method::GET) - } - - /// Create new `POST` route. - pub fn post() -> Route

{ - Route::new().method(Method::POST) - } - - /// Create new `PUT` route. - pub fn put() -> Route

{ - Route::new().method(Method::PUT) - } - - /// Create new `DELETE` route. - pub fn delete() -> Route

{ - Route::new().method(Method::DELETE) - } - pub(crate) fn finish(self) -> Self { *self.config_ref.borrow_mut() = self.config.storage.clone(); self diff --git a/src/scope.rs b/src/scope.rs index a6358869a..2c2e3c2ba 100644 --- a/src/scope.rs +++ b/src/scope.rs @@ -451,7 +451,7 @@ mod tests { use actix_service::Service; use bytes::Bytes; - use crate::body::{Body, ResponseBody}; + use crate::dev::{Body, ResponseBody}; use crate::http::{Method, StatusCode}; use crate::test::{block_on, init_service, TestRequest}; use crate::{guard, web, App, HttpRequest, HttpResponse};