1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-27 17:22:57 +01:00

prepare actix-files release

This commit is contained in:
Nikolay Kim 2019-10-08 10:13:16 +06:00
parent 4de2e8a898
commit a464ffc23d
3 changed files with 14 additions and 17 deletions

View File

@ -1,6 +1,6 @@
# Changes # Changes
## [0.1.5] - unreleased ## [0.1.5] - 2019-10-08
* Bump up `mime_guess` crate version to 2.0.1 * Bump up `mime_guess` crate version to 2.0.1
@ -8,6 +8,7 @@
* Allow user defined request guards for `Files` #1113 * Allow user defined request guards for `Files` #1113
## [0.1.4] - 2019-07-20 ## [0.1.4] - 2019-07-20
* Allow to disable `Content-Disposition` header #686 * Allow to disable `Content-Disposition` header #686

View File

@ -1,6 +1,6 @@
[package] [package]
name = "actix-files" name = "actix-files"
version = "0.1.4" version = "0.1.5"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"] authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Static files support for actix web." description = "Static files support for actix web."
readme = "README.md" readme = "README.md"
@ -18,7 +18,7 @@ name = "actix_files"
path = "src/lib.rs" path = "src/lib.rs"
[dependencies] [dependencies]
actix-web = { version = "1.0.2", default-features = false } actix-web = { version = "1.0.8", default-features = false }
actix-http = "0.2.9" actix-http = "0.2.9"
actix-service = "0.4.1" actix-service = "0.4.1"
bitflags = "1" bitflags = "1"
@ -32,4 +32,4 @@ percent-encoding = "2.1"
v_htmlescape = "0.4" v_htmlescape = "0.4"
[dev-dependencies] [dev-dependencies]
actix-web = { version = "1.0.2", features=["ssl"] } actix-web = { version = "1.0.8", features=["ssl"] }

View File

@ -15,8 +15,8 @@ use actix_web::dev::{
AppService, HttpServiceFactory, Payload, ResourceDef, ServiceRequest, AppService, HttpServiceFactory, Payload, ResourceDef, ServiceRequest,
ServiceResponse, ServiceResponse,
}; };
use actix_web::guard::Guard;
use actix_web::error::{BlockingError, Error, ErrorInternalServerError}; use actix_web::error::{BlockingError, Error, ErrorInternalServerError};
use actix_web::guard::Guard;
use actix_web::http::header::{self, DispositionType}; use actix_web::http::header::{self, DispositionType};
use actix_web::http::Method; use actix_web::http::Method;
use actix_web::{web, FromRequest, HttpRequest, HttpResponse, Responder}; use actix_web::{web, FromRequest, HttpRequest, HttpResponse, Responder};
@ -485,7 +485,7 @@ impl Service for FilesService {
return Either::A(ok(req.into_response( return Either::A(ok(req.into_response(
actix_web::HttpResponse::MethodNotAllowed() actix_web::HttpResponse::MethodNotAllowed()
.header(header::CONTENT_TYPE, "text/plain") .header(header::CONTENT_TYPE, "text/plain")
.body("Request did not meet this resource's requirements.") .body("Request did not meet this resource's requirements."),
))); )));
} }
@ -1047,9 +1047,7 @@ mod tests {
#[test] #[test]
fn test_files_not_allowed() { fn test_files_not_allowed() {
let mut srv = test::init_service( let mut srv = test::init_service(App::new().service(Files::new("/", ".")));
App::new().service(Files::new("/", ".")),
);
let req = TestRequest::default() let req = TestRequest::default()
.uri("/Cargo.toml") .uri("/Cargo.toml")
@ -1059,10 +1057,11 @@ mod tests {
let resp = test::call_service(&mut srv, req); let resp = test::call_service(&mut srv, req);
assert_eq!(resp.status(), StatusCode::METHOD_NOT_ALLOWED); assert_eq!(resp.status(), StatusCode::METHOD_NOT_ALLOWED);
let mut srv = test::init_service( let mut srv = test::init_service(App::new().service(Files::new("/", ".")));
App::new().service(Files::new("/", ".")), let req = TestRequest::default()
); .method(Method::PUT)
let req = TestRequest::default().method(Method::PUT).uri("/Cargo.toml").to_request(); .uri("/Cargo.toml")
.to_request();
let resp = test::call_service(&mut srv, req); let resp = test::call_service(&mut srv, req);
assert_eq!(resp.status(), StatusCode::METHOD_NOT_ALLOWED); assert_eq!(resp.status(), StatusCode::METHOD_NOT_ALLOWED);
} }
@ -1070,10 +1069,7 @@ mod tests {
#[test] #[test]
fn test_files_guards() { fn test_files_guards() {
let mut srv = test::init_service( let mut srv = test::init_service(
App::new().service( App::new().service(Files::new("/", ".").use_guards(guard::Post())),
Files::new("/", ".")
.use_guards(guard::Post())
),
); );
let req = TestRequest::default() let req = TestRequest::default()