mirror of https://github.com/fafhrd91/actix-web
[actix-files] remove request method checks from NamedFile
This commit is contained in:
parent
fba31d4e0a
commit
d6f6b1ebad
|
@ -15,7 +15,7 @@ use actix_http::body::SizedStream;
|
||||||
use actix_web::http::header::{
|
use actix_web::http::header::{
|
||||||
self, ContentDisposition, DispositionParam, DispositionType,
|
self, ContentDisposition, DispositionParam, DispositionType,
|
||||||
};
|
};
|
||||||
use actix_web::http::{ContentEncoding, Method, StatusCode};
|
use actix_web::http::{ContentEncoding, StatusCode};
|
||||||
use actix_web::middleware::BodyEncoding;
|
use actix_web::middleware::BodyEncoding;
|
||||||
use actix_web::{Error, HttpMessage, HttpRequest, HttpResponse, Responder};
|
use actix_web::{Error, HttpMessage, HttpRequest, HttpResponse, Responder};
|
||||||
|
|
||||||
|
@ -324,16 +324,6 @@ impl Responder for NamedFile {
|
||||||
return Ok(resp.streaming(reader));
|
return Ok(resp.streaming(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
match *req.method() {
|
|
||||||
Method::HEAD | Method::GET => (),
|
|
||||||
_ => {
|
|
||||||
return Ok(HttpResponse::MethodNotAllowed()
|
|
||||||
.header(header::CONTENT_TYPE, "text/plain")
|
|
||||||
.header(header::ALLOW, "GET, HEAD")
|
|
||||||
.body("This resource only supports GET and HEAD."));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let etag = if self.flags.contains(Flags::ETAG) {
|
let etag = if self.flags.contains(Flags::ETAG) {
|
||||||
self.etag()
|
self.etag()
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue