mirror of
https://github.com/actix/actix-extras.git
synced 2025-06-25 18:09:22 +02:00
Fix scope resource path extractor #234
This commit is contained in:
10
src/param.rs
10
src/param.rs
@ -58,6 +58,16 @@ impl<'a> Params<'a> {
|
||||
self.0.push((name, value));
|
||||
}
|
||||
|
||||
pub(crate) fn remove(&mut self, name: &str)
|
||||
{
|
||||
for idx in (0..self.0.len()).rev() {
|
||||
if self.0[idx].0 == name {
|
||||
self.0.remove(idx);
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Check if there are any matched patterns
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.0.is_empty()
|
||||
|
@ -336,6 +336,7 @@ impl<S: 'static> RouteHandler<S> for Scope<S> {
|
||||
if pattern.match_with_params(path, req.match_info_mut()) {
|
||||
let default = unsafe { &mut *self.default.as_ref().get() };
|
||||
|
||||
req.match_info_mut().remove("tail");
|
||||
if self.middlewares.is_empty() {
|
||||
let resource = unsafe { &mut *resource.get() };
|
||||
return resource.handle(req, Some(default));
|
||||
|
Reference in New Issue
Block a user