Skip to content

Commit 570e74b

Browse files
committed
set assert! message when misusing cache control
1 parent 92a393b commit 570e74b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/web/cache.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,10 @@ impl AfterMiddleware for CacheMiddleware {
101101
.unwrap_or(&CachePolicy::NoCaching);
102102

103103
if cfg!(test) {
104-
// handlers should never set their own caching headers and
105-
// only use the caching header templates above.
106-
assert!(!res.headers.has::<CacheControl>());
104+
assert!(
105+
!res.headers.has::<CacheControl>(),
106+
"handlers should never set their own caching headers and only use CachePolicy to control caching."
107+
);
107108
}
108109

109110
res.headers.set(CacheControl(cache.render(config)));

0 commit comments

Comments
 (0)