mirror of https://github.com/fafhrd91/actix-web
Compare commits
4 Commits
819ee93e9b
...
c4be19942b
Author | SHA1 | Date |
---|---|---|
|
c4be19942b | |
|
acd7c58097 | |
|
176ea5da77 | |
|
91fa813f0e |
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
- Add `resources-introspection` feature for retrieving configured route paths and HTTP methods.
|
||||||
- Implement `Responder` for `Result<(), E: Into<Error>>`. Returning `Ok(())` responds with HTTP 204 No Content.
|
- Implement `Responder` for `Result<(), E: Into<Error>>`. Returning `Ok(())` responds with HTTP 204 No Content.
|
||||||
- On Windows, an error is now returned from `HttpServer::bind()` (or TLS variants) when binding to a socket that's already in use.
|
- On Windows, an error is now returned from `HttpServer::bind()` (or TLS variants) when binding to a socket that's already in use.
|
||||||
- Update `brotli` dependency to `7`.
|
- Update `brotli` dependency to `7`.
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
//! or handler. This interface is defined by the [`Guard`] trait.
|
//! or handler. This interface is defined by the [`Guard`] trait.
|
||||||
//!
|
//!
|
||||||
//! Commonly-used guards are provided in this module as well as a way of creating a guard from a
|
//! Commonly-used guards are provided in this module as well as a way of creating a guard from a
|
||||||
//! closure ([`fn_guard`]). The [`Not`], [`Any`], and [`All`] guards are noteworthy, as they can be
|
//! closure ([`fn_guard`]). The [`Not`], [`Any()`], and [`All`] guards are noteworthy, as they can be
|
||||||
//! used to compose other guards in a more flexible and semantic way than calling `.guard(...)` on
|
//! used to compose other guards in a more flexible and semantic way than calling `.guard(...)` on
|
||||||
//! services multiple times (which might have different combining behavior than you want).
|
//! services multiple times (which might have different combining behavior than you want).
|
||||||
//!
|
//!
|
||||||
|
@ -196,7 +196,7 @@ pub fn Any<F: Guard + 'static>(guard: F) -> AnyGuard {
|
||||||
///
|
///
|
||||||
/// That is, only one contained guard needs to match in order for the aggregate guard to match.
|
/// That is, only one contained guard needs to match in order for the aggregate guard to match.
|
||||||
///
|
///
|
||||||
/// Construct an `AnyGuard` using [`Any`].
|
/// Construct an `AnyGuard` using [`Any()`].
|
||||||
pub struct AnyGuard {
|
pub struct AnyGuard {
|
||||||
guards: Vec<Box<dyn Guard>>,
|
guards: Vec<Box<dyn Guard>>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -442,8 +442,8 @@ where
|
||||||
{
|
{
|
||||||
rmap.add(&mut rdef, None);
|
rmap.add(&mut rdef, None);
|
||||||
|
|
||||||
self.routes.iter_mut().for_each(|r| {
|
self.routes.iter().for_each(|r| {
|
||||||
r.take_guards().iter().for_each(|g| {
|
r.get_guards().iter().for_each(|g| {
|
||||||
let http_methods: Vec<String> =
|
let http_methods: Vec<String> =
|
||||||
crate::guard::HttpMethodsExtractor::extract_http_methods(&**g);
|
crate::guard::HttpMethodsExtractor::extract_http_methods(&**g);
|
||||||
rdef_methods
|
rdef_methods
|
||||||
|
|
|
@ -65,6 +65,11 @@ impl Route {
|
||||||
pub(crate) fn take_guards(&mut self) -> Vec<Box<dyn Guard>> {
|
pub(crate) fn take_guards(&mut self) -> Vec<Box<dyn Guard>> {
|
||||||
mem::take(Rc::get_mut(&mut self.guards).unwrap())
|
mem::take(Rc::get_mut(&mut self.guards).unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "resources-introspection")]
|
||||||
|
pub(crate) fn get_guards(&self) -> &Vec<Box<dyn Guard>> {
|
||||||
|
&self.guards
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ServiceFactory<ServiceRequest> for Route {
|
impl ServiceFactory<ServiceRequest> for Route {
|
||||||
|
|
2
justfile
2
justfile
|
@ -13,6 +13,8 @@ downgrade-for-msrv:
|
||||||
cargo update -p=parse-size --precise=1.0.0
|
cargo update -p=parse-size --precise=1.0.0
|
||||||
cargo update -p=clap --precise=4.4.18
|
cargo update -p=clap --precise=4.4.18
|
||||||
cargo update -p=divan --precise=0.1.15
|
cargo update -p=divan --precise=0.1.15
|
||||||
|
cargo update -p=litemap --precise=0.7.4
|
||||||
|
cargo update -p=zerofrom --precise=0.1.5
|
||||||
|
|
||||||
msrv := ```
|
msrv := ```
|
||||||
cargo metadata --format-version=1 \
|
cargo metadata --format-version=1 \
|
||||||
|
|
Loading…
Reference in New Issue