1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-24 00:21:08 +01:00

Enable compression support for NamedFile

This commit is contained in:
Nikolay Kim 2018-03-05 13:31:30 -08:00
parent b282ec106e
commit c8844425ad
3 changed files with 3 additions and 2 deletions

View File

@ -2,6 +2,8 @@
## 0.4.5 (2018-03-xx) ## 0.4.5 (2018-03-xx)
* Enable compression support for `NamedFile`
* Add `ResponseError` impl for `SendRequestError`. * Add `ResponseError` impl for `SendRequestError`.
This improves ergonomics of http client. This improves ergonomics of http client.

View File

@ -24,7 +24,7 @@ fn index(_req: HttpRequest) -> Box<Future<Item=HttpResponse, Error=Error>> {
.responder() .responder()
} }
/// stream client request to a server response /// streaming client request to a streaming server response
fn streaming(_req: HttpRequest) -> Box<Future<Item=HttpResponse, Error=Error>> { fn streaming(_req: HttpRequest) -> Box<Future<Item=HttpResponse, Error=Error>> {
// send client request // send client request
client::ClientRequest::get("https://www.rust-lang.org/en-US/") client::ClientRequest::get("https://www.rust-lang.org/en-US/")

View File

@ -85,7 +85,6 @@ impl Responder for NamedFile {
fn respond_to(mut self, _: HttpRequest) -> Result<HttpResponse, io::Error> { fn respond_to(mut self, _: HttpRequest) -> Result<HttpResponse, io::Error> {
let mut resp = HttpOk.build(); let mut resp = HttpOk.build();
resp.content_encoding(ContentEncoding::Identity);
if let Some(ext) = self.path().extension() { if let Some(ext) = self.path().extension() {
let mime = get_mime_type(&ext.to_string_lossy()); let mime = get_mime_type(&ext.to_string_lossy());
resp.content_type(format!("{}", mime).as_str()); resp.content_type(format!("{}", mime).as_str());