pub struct QueryMethod { /* private fields */ }
Expand description
A middleware to pick HTTP method (PUT, DELETE, …) with a query parameter.
This is useful for HTML forms which only support GET and POST methods. Using a query parameter, you can have this middleware route the request to another method.
Implementations§
Source§impl QueryMethod
impl QueryMethod
Sourcepub fn parameter_name(&mut self, name: &str) -> Self
pub fn parameter_name(&mut self, name: &str) -> Self
The parameter name to use. By default this is _method
, meaning that
you need to send your request like /path?_method=POST
to use this
middleware. If you happen to already use _method
in your application,
you can override the parameter name used here to pick something else.
Sourcepub fn enable_strict_mode(&mut self) -> Self
pub fn enable_strict_mode(&mut self) -> Self
Disabled by default. When enabled, the middleware will respond to non-POST requests by rejecting them with a 400 code response.
Sourcepub fn disable_strict_mode(&mut self) -> Self
pub fn disable_strict_mode(&mut self) -> Self
Disabled by default. When disabled, the middleware will allow non-POST requests that have
Trait Implementations§
Source§impl Clone for QueryMethod
impl Clone for QueryMethod
Source§fn clone(&self) -> QueryMethod
fn clone(&self) -> QueryMethod
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for QueryMethod
impl Debug for QueryMethod
Source§impl Default for QueryMethod
impl Default for QueryMethod
Source§impl<S, B> Transform<S, ServiceRequest> for QueryMethodwhere
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error> + 'static,
S::Future: 'static,
impl<S, B> Transform<S, ServiceRequest> for QueryMethodwhere
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error> + 'static,
S::Future: 'static,
Source§type Response = ServiceResponse<EitherBody<B>>
type Response = ServiceResponse<EitherBody<B>>
Responses produced by the service.
Source§type Transform = QueryMethodMiddleware<S>
type Transform = QueryMethodMiddleware<S>
The
TransformService
value created by this factorySource§type Future = Ready<Result<<QueryMethod as Transform<S, ServiceRequest>>::Transform, <QueryMethod as Transform<S, ServiceRequest>>::InitError>>
type Future = Ready<Result<<QueryMethod as Transform<S, ServiceRequest>>::Transform, <QueryMethod as Transform<S, ServiceRequest>>::InitError>>
The future response value.
Source§fn new_transform(&self, service: S) -> Self::Future
fn new_transform(&self, service: S) -> Self::Future
Creates and returns a new Transform component, asynchronously
Auto Trait Implementations§
impl Freeze for QueryMethod
impl RefUnwindSafe for QueryMethod
impl Send for QueryMethod
impl Sync for QueryMethod
impl Unpin for QueryMethod
impl UnwindSafe for QueryMethod
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more