Skip to content

Commit 179233b

Browse files
committed
middleware::log_request: Replace unwrap() call with request.path() fallback
1 parent 2d45197 commit 179233b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/middleware/log_request.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,9 @@ impl<'a> Display for FullPath<'a> {
170170

171171
let original_path = request.extensions().find::<OriginalPath>();
172172
// 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();
173+
let path = original_path
174+
.map(|p| p.0.as_str())
175+
.unwrap_or_else(|| request.path());
174176

175177
write!(f, "{}", path)?;
176178

0 commit comments

Comments
 (0)