From 0c80f7d9e0fa5c88c41a3c21502a35f97d31e969 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Mon, 10 Apr 2023 13:42:20 -0700 Subject: [PATCH] Return 'Path' from 'Catcher::base()'. --- core/lib/src/catcher/catcher.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/core/lib/src/catcher/catcher.rs b/core/lib/src/catcher/catcher.rs index a477fac4..8ec7b1b7 100644 --- a/core/lib/src/catcher/catcher.rs +++ b/core/lib/src/catcher/catcher.rs @@ -1,6 +1,7 @@ use std::fmt; use std::io::Cursor; +use crate::http::uri::Path; use crate::response::Response; use crate::request::Request; use crate::http::{Status, ContentType, uri}; @@ -198,13 +199,13 @@ impl Catcher { /// } /// /// let catcher = Catcher::new(404, handle_404); - /// assert_eq!(catcher.base().path(), "/"); + /// assert_eq!(catcher.base(), "/"); /// /// let catcher = catcher.map_base(|base| format!("/foo/bar/{}", base)).unwrap(); - /// assert_eq!(catcher.base().path(), "/foo/bar"); + /// assert_eq!(catcher.base(), "/foo/bar"); /// ``` - pub fn base(&self) -> &uri::Origin<'_> { - &self.base + pub fn base(&self) -> Path<'_> { + self.base.path() } /// Maps the `base` of this catcher using `mapper`, returning a new @@ -229,13 +230,13 @@ impl Catcher { /// } /// /// let catcher = Catcher::new(404, handle_404); - /// assert_eq!(catcher.base().path(), "/"); + /// assert_eq!(catcher.base(), "/"); /// /// let catcher = catcher.map_base(|_| format!("/bar")).unwrap(); - /// assert_eq!(catcher.base().path(), "/bar"); + /// assert_eq!(catcher.base(), "/bar"); /// /// let catcher = catcher.map_base(|base| format!("/foo{}", base)).unwrap(); - /// assert_eq!(catcher.base().path(), "/foo/bar"); + /// assert_eq!(catcher.base(), "/foo/bar"); /// /// let catcher = catcher.map_base(|base| format!("/foo ? {}", base)); /// assert!(catcher.is_err());