Skip to content

Commit

Permalink
Merge pull request #258 from cburgdorf/send_file_ergonomics
Browse files Browse the repository at this point in the history
feat(render): improve ergonomics of send_file
  • Loading branch information
Ryman committed Aug 12, 2015
2 parents 2011b70 + 55d97f4 commit 3fd622f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ impl<'a> Response<'a, Fresh> {
/// res.send_file(favicon)
/// }
/// ```
pub fn send_file(mut self, path: &Path) -> MiddlewareResult<'a> {
pub fn send_file<P:AsRef<Path>>(mut self, path: P) -> MiddlewareResult<'a> {
let path = path.as_ref();
// Chunk the response
self.origin.headers_mut().remove::<ContentLength>();
// Determine content type by file extension or default to binary
Expand Down

0 comments on commit 3fd622f

Please sign in to comment.