Skip to content

Commit

Permalink
Relax constraints on cache control
Browse files Browse the repository at this point in the history
  • Loading branch information
whitfin committed Sep 30, 2018
1 parent 78ad1b4 commit e15ed6f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/static_assets/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub fn main() {
// control headers etc by building a `FileOptions` instance.
route.get("assets/*").to_dir(
FileOptions::new(&path)
.with_cache_control("no-cache".to_string())
.with_cache_control("no-cache")
.with_gzip(true)
.build(),
);
Expand Down
6 changes: 3 additions & 3 deletions gotham/src/handler/assets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ impl FileOptions {
}

/// Sets the "cache_control" header in static file responses to the given value.
pub fn with_cache_control(&mut self, cache_control: String) -> &mut Self {
self.cache_control = cache_control;
pub fn with_cache_control(&mut self, cache_control: &str) -> &mut Self {
self.cache_control = cache_control.to_owned();
self
}

Expand Down Expand Up @@ -601,7 +601,7 @@ mod tests {
let router = build_simple_router(|route| {
route.get("/*").to_dir(
FileOptions::new("resources/test/assets")
.with_cache_control("no-cache".to_string())
.with_cache_control("no-cache")
.build(),
)
});
Expand Down

0 comments on commit e15ed6f

Please sign in to comment.