mirror of
https://github.com/actix/actix-extras.git
synced 2025-06-26 10:27:42 +02:00
actix-web beta 15 updates (#216)
This commit is contained in:
@ -3,6 +3,12 @@
|
||||
## Unreleased - 2021-xx-xx
|
||||
|
||||
|
||||
## 0.6.0-beta.7 - 2021-12-18
|
||||
* Update `actix-web` dependency to `4.0.0.beta-15`. [#216]
|
||||
|
||||
[#216]: https://github.com/actix/actix-extras/pull/216
|
||||
|
||||
|
||||
## 0.6.0-beta.6 - 2021-12-13
|
||||
* Fix panic when wrapping routes with dynamic segments in their paths. [#213]
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "actix-cors"
|
||||
version = "0.6.0-beta.6"
|
||||
version = "0.6.0-beta.7"
|
||||
authors = [
|
||||
"Nikolay Kim <fafhrd91@gmail.com>",
|
||||
"Rob Ede <robjtede@icloud.com>",
|
||||
@ -17,9 +17,9 @@ name = "actix_cors"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
actix-service = "2.0.0"
|
||||
actix-service = "2"
|
||||
actix-utils = "3"
|
||||
actix-web = { version = "4.0.0-beta.14", default-features = false }
|
||||
actix-web = { version = "4.0.0-beta.15", default-features = false }
|
||||
|
||||
derive_more = "0.99.5"
|
||||
futures-util = { version = "0.3.7", default-features = false }
|
||||
|
@ -3,9 +3,9 @@
|
||||
> Cross-origin resource sharing (CORS) for Actix Web.
|
||||
|
||||
[](https://crates.io/crates/actix-cors)
|
||||
[](https://docs.rs/actix-cors/0.6.0-beta.6)
|
||||
[](https://docs.rs/actix-cors/0.6.0-beta.7)
|
||||

|
||||
[](https://deps.rs/crate/actix-cors/0.6.0-beta.6)
|
||||
[](https://deps.rs/crate/actix-cors/0.6.0-beta.7)
|
||||
|
||||
## Documentation & Resources
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
use std::{
|
||||
collections::HashSet, convert::TryInto, error::Error as StdError, iter::FromIterator, rc::Rc,
|
||||
};
|
||||
use std::{collections::HashSet, convert::TryInto, iter::FromIterator, rc::Rc};
|
||||
|
||||
use actix_utils::future::{self, Ready};
|
||||
use actix_web::{
|
||||
@ -490,8 +488,9 @@ impl<S, B> Transform<S, ServiceRequest> for Cors
|
||||
where
|
||||
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
|
||||
S::Future: 'static,
|
||||
|
||||
B: MessageBody + 'static,
|
||||
B::Error: StdError,
|
||||
B::Error: Into<Error>,
|
||||
{
|
||||
type Response = ServiceResponse<EitherBody<B>>;
|
||||
type Error = Error;
|
||||
@ -636,7 +635,7 @@ mod test {
|
||||
#[actix_rt::test]
|
||||
async fn middleware_generic_over_body_type() {
|
||||
let srv = fn_service(|req: ServiceRequest| async move {
|
||||
Ok(req.into_response(HttpResponse::Ok().message_body(body::None::new())?))
|
||||
Ok(req.into_response(HttpResponse::with_body(StatusCode::OK, body::None::new())))
|
||||
});
|
||||
|
||||
Cors::default().new_transform(srv).await.unwrap();
|
||||
|
@ -1,15 +1,14 @@
|
||||
use std::{collections::HashSet, convert::TryInto, error::Error as StdError, rc::Rc};
|
||||
use std::{collections::HashSet, convert::TryInto, rc::Rc};
|
||||
|
||||
use actix_utils::future::ok;
|
||||
use actix_web::{
|
||||
body::{EitherBody, MessageBody},
|
||||
dev::{Service, ServiceRequest, ServiceResponse},
|
||||
error::{Error, Result},
|
||||
http::{
|
||||
header::{self, HeaderValue},
|
||||
Method,
|
||||
},
|
||||
HttpResponse,
|
||||
Error, HttpResponse, Result,
|
||||
};
|
||||
use futures_util::future::{FutureExt as _, LocalBoxFuture};
|
||||
use log::debug;
|
||||
@ -138,8 +137,9 @@ impl<S, B> Service<ServiceRequest> for CorsMiddleware<S>
|
||||
where
|
||||
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
|
||||
S::Future: 'static,
|
||||
|
||||
B: MessageBody + 'static,
|
||||
B::Error: StdError,
|
||||
B::Error: Into<Error>,
|
||||
{
|
||||
type Response = ServiceResponse<EitherBody<B>>;
|
||||
type Error = Error;
|
||||
@ -172,7 +172,7 @@ where
|
||||
if origin.is_some() {
|
||||
Ok(Self::augment_response(&inner, res?))
|
||||
} else {
|
||||
res
|
||||
res.map_err(Into::into)
|
||||
}
|
||||
.map(|res| res.map_into_left_body())
|
||||
}
|
||||
|
Reference in New Issue
Block a user