mirror of
https://github.com/fafhrd91/actix-web
synced 2025-08-31 08:57:00 +02:00
add resource map, it allow to check if router has resource and it allows to generate urls for named resources
This commit is contained in:
@@ -15,6 +15,7 @@ use futures::future::{ok, FutureResult, IntoFuture};
|
||||
|
||||
use crate::config::AppConfig;
|
||||
use crate::request::HttpRequest;
|
||||
use crate::rmap::ResourceMap;
|
||||
|
||||
pub trait HttpServiceFactory<P> {
|
||||
fn register(self, config: &mut AppConfig<P>);
|
||||
@@ -58,12 +59,13 @@ impl<P> ServiceRequest<P> {
|
||||
pub(crate) fn new(
|
||||
path: Path<Url>,
|
||||
request: Request<P>,
|
||||
rmap: Rc<ResourceMap>,
|
||||
extensions: Rc<Extensions>,
|
||||
) -> Self {
|
||||
let (head, payload) = request.into_parts();
|
||||
ServiceRequest {
|
||||
payload,
|
||||
req: HttpRequest::new(head, path, extensions),
|
||||
req: HttpRequest::new(head, path, rmap, extensions),
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user