Skip to content

Commit 5872d74

Browse files
committed
middleware::log_request: Replace unwrap() call with request.path() fallback
1 parent 18b9c34 commit 5872d74

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/middleware/log_request.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,9 @@ impl<'a> Display for FullPath<'a> {
169169
let request = self.0;
170170

171171
let original_path = request.extensions().find::<OriginalPath>();
172-
// Unwrap shouldn't panic as no other code has access to the private struct to remove it
173-
let path = original_path.map(|p| p.0.as_str()).unwrap();
172+
let path = original_path
173+
.map(|p| p.0.as_str())
174+
.unwrap_or_else(|| request.path());
174175

175176
write!(f, "{}", path)?;
176177

0 commit comments

Comments
 (0)