1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-02-02 10:59:03 +01:00

Merge pull request #20 from JohnTitor/cors

Release `actix-cors` v0.3.0-alpha.1
This commit is contained in:
Yuki Okushi 2020-03-12 06:46:02 +09:00 committed by GitHub
commit 62cf9baa51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 8 deletions

View File

@ -1,5 +1,10 @@
# Changes # Changes
## [0.3.0-alpha.1] - 2020-03-11
* Minimize `futures-*` dependencies
* Update `actix-web` dependency to 3.0.0-alpha.1
## [0.2.0] - 2019-12-20 ## [0.2.0] - 2019-12-20
* Release * Release

View File

@ -1,6 +1,6 @@
[package] [package]
name = "actix-cors" name = "actix-cors"
version = "0.2.0" version = "0.3.0-alpha.1"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"] authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Cross-origin resource sharing (CORS) for actix-web applications." description = "Cross-origin resource sharing (CORS) for actix-web applications."
readme = "README.md" readme = "README.md"
@ -16,10 +16,10 @@ name = "actix_cors"
path = "src/lib.rs" path = "src/lib.rs"
[dependencies] [dependencies]
actix-web = "2.0.0" actix-web = "3.0.0-alpha.1"
actix-service = "1.0.1" actix-service = "1.0.1"
derive_more = "0.99.2" derive_more = "0.99.2"
futures = "0.3.1" futures-util = { version = "0.3.4", default-features = false }
[dev-dependencies] [dev-dependencies]
actix-rt = "1.0.0" actix-rt = "1.0.0"

View File

@ -52,7 +52,7 @@ use actix_web::http::header::{self, HeaderName, HeaderValue};
use actix_web::http::{self, Error as HttpError, Method, StatusCode, Uri}; use actix_web::http::{self, Error as HttpError, Method, StatusCode, Uri};
use actix_web::HttpResponse; use actix_web::HttpResponse;
use derive_more::Display; use derive_more::Display;
use futures::future::{ok, Either, FutureExt, LocalBoxFuture, Ready}; use futures_util::future::{ok, Either, FutureExt, LocalBoxFuture, Ready};
/// A set of errors that can occur during processing CORS /// A set of errors that can occur during processing CORS
#[derive(Debug, Display)] #[derive(Debug, Display)]
@ -776,10 +776,8 @@ where
if let Some(origin) = if let Some(origin) =
inner.access_control_allow_origin(res.request().head()) inner.access_control_allow_origin(res.request().head())
{ {
res.headers_mut().insert( res.headers_mut()
header::ACCESS_CONTROL_ALLOW_ORIGIN, .insert(header::ACCESS_CONTROL_ALLOW_ORIGIN, origin);
origin,
);
}; };
if let Some(ref expose) = inner.expose_hdrs { if let Some(ref expose) = inner.expose_hdrs {