mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-23 16:21:06 +01:00
bump actix dependency to v0.10 (#1666)
This commit is contained in:
parent
cf5138e740
commit
bf53fe5a22
@ -92,7 +92,7 @@ mime = "0.3"
|
|||||||
socket2 = "0.3"
|
socket2 = "0.3"
|
||||||
pin-project = "0.4.17"
|
pin-project = "0.4.17"
|
||||||
regex = "1.3"
|
regex = "1.3"
|
||||||
serde = { version = "1.0", features=["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
serde_urlencoded = "0.6.1"
|
serde_urlencoded = "0.6.1"
|
||||||
time = { version = "0.2.7", default-features = false, features = ["std"] }
|
time = { version = "0.2.7", default-features = false, features = ["std"] }
|
||||||
@ -102,7 +102,8 @@ rust-tls = { package = "rustls", version = "0.18.0", optional = true }
|
|||||||
tinyvec = { version = "0.3", features = ["alloc"] }
|
tinyvec = { version = "0.3", features = ["alloc"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
actix = "0.10.0-alpha.1"
|
actix = "0.10.0"
|
||||||
|
actix-http = { version = "2.0.0-beta.4", features = ["actors"] }
|
||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
env_logger = "0.7"
|
env_logger = "0.7"
|
||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
|
@ -47,7 +47,7 @@ actix-utils = "2.0.0"
|
|||||||
actix-rt = "1.0.0"
|
actix-rt = "1.0.0"
|
||||||
actix-threadpool = "0.3.1"
|
actix-threadpool = "0.3.1"
|
||||||
actix-tls = { version = "2.0.0", optional = true }
|
actix-tls = { version = "2.0.0", optional = true }
|
||||||
actix = { version = "0.10.0-alpha.1", optional = true }
|
actix = { version = "0.10.0", optional = true }
|
||||||
|
|
||||||
base64 = "0.12"
|
base64 = "0.12"
|
||||||
bitflags = "1.2"
|
bitflags = "1.2"
|
||||||
|
@ -283,11 +283,11 @@ impl DispositionParam {
|
|||||||
/// Some("\u{1f600}.svg".as_bytes()));
|
/// Some("\u{1f600}.svg".as_bytes()));
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// # WARN
|
/// # Security Note
|
||||||
|
///
|
||||||
/// If "filename" parameter is supplied, do not use the file name blindly, check and possibly
|
/// If "filename" parameter is supplied, do not use the file name blindly, check and possibly
|
||||||
/// change to match local file system conventions if applicable, and do not use directory path
|
/// change to match local file system conventions if applicable, and do not use directory path
|
||||||
/// information that may be present. See [RFC2183](https://tools.ietf.org/html/rfc2183#section-2.3)
|
/// information that may be present. See [RFC2183](https://tools.ietf.org/html/rfc2183#section-2.3).
|
||||||
/// .
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
pub struct ContentDisposition {
|
pub struct ContentDisposition {
|
||||||
/// The disposition type
|
/// The disposition type
|
||||||
|
@ -16,7 +16,7 @@ name = "actix_web_actors"
|
|||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix = "0.10.0-alpha.2"
|
actix = "0.10.0"
|
||||||
actix-web = { version = "3.0.0-beta.4", default-features = false }
|
actix-web = { version = "3.0.0-beta.4", default-features = false }
|
||||||
actix-http = "2.0.0-beta.4"
|
actix-http = "2.0.0-beta.4"
|
||||||
actix-codec = "0.3.0"
|
actix-codec = "0.3.0"
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
//! * Middlewares ([Logger, Session, CORS, etc](https://actix.rs/docs/middleware/))
|
//! * Middlewares ([Logger, Session, CORS, etc](https://actix.rs/docs/middleware/))
|
||||||
//! * Includes an async [HTTP client](https://actix.rs/actix-web/actix_web/client/index.html)
|
//! * Includes an async [HTTP client](https://actix.rs/actix-web/actix_web/client/index.html)
|
||||||
//! * Supports [Actix actor framework](https://github.com/actix/actix)
|
//! * Supports [Actix actor framework](https://github.com/actix/actix)
|
||||||
//! * Runs on stable Rust 1.41+
|
//! * Runs on stable Rust 1.42+
|
||||||
//!
|
//!
|
||||||
//! ## Crate Features
|
//! ## Crate Features
|
||||||
//!
|
//!
|
||||||
|
93
src/test.rs
93
src/test.rs
@ -1281,53 +1281,54 @@ mod tests {
|
|||||||
assert!(res.status().is_success());
|
assert!(res.status().is_success());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
#[actix_rt::test]
|
||||||
|
async fn test_actor() {
|
||||||
|
use crate::Error;
|
||||||
|
use actix::prelude::*;
|
||||||
|
|
||||||
Comment out until actix decoupled of actix-http:
|
struct MyActor;
|
||||||
https://github.com/actix/actix/issues/321
|
|
||||||
|
|
||||||
use futures::FutureExt;
|
impl Actor for MyActor {
|
||||||
|
type Context = Context<Self>;
|
||||||
#[actix_rt::test]
|
|
||||||
async fn test_actor() {
|
|
||||||
use actix::Actor;
|
|
||||||
|
|
||||||
struct MyActor;
|
|
||||||
|
|
||||||
struct Num(usize);
|
|
||||||
impl actix::Message for Num {
|
|
||||||
type Result = usize;
|
|
||||||
}
|
|
||||||
impl actix::Actor for MyActor {
|
|
||||||
type Context = actix::Context<Self>;
|
|
||||||
}
|
|
||||||
impl actix::Handler<Num> for MyActor {
|
|
||||||
type Result = usize;
|
|
||||||
fn handle(&mut self, msg: Num, _: &mut Self::Context) -> Self::Result {
|
|
||||||
msg.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let mut app = init_service(App::new().service(web::resource("/index.html").to(
|
|
||||||
move || {
|
|
||||||
addr.send(Num(1)).map(|res| match res {
|
|
||||||
Ok(res) => {
|
|
||||||
if res == 1 {
|
|
||||||
Ok(HttpResponse::Ok())
|
|
||||||
} else {
|
|
||||||
Ok(HttpResponse::BadRequest())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Err(err) => Err(err),
|
|
||||||
})
|
|
||||||
},
|
|
||||||
)))
|
|
||||||
.await;
|
|
||||||
|
|
||||||
let req = TestRequest::post().uri("/index.html").to_request();
|
|
||||||
let res = app.call(req).await.unwrap();
|
|
||||||
assert!(res.status().is_success());
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
struct Num(usize);
|
||||||
|
|
||||||
|
impl Message for Num {
|
||||||
|
type Result = usize;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Handler<Num> for MyActor {
|
||||||
|
type Result = usize;
|
||||||
|
|
||||||
|
fn handle(&mut self, msg: Num, _: &mut Self::Context) -> Self::Result {
|
||||||
|
msg.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let addr = MyActor.start();
|
||||||
|
|
||||||
|
async fn actor_handler(
|
||||||
|
addr: Data<Addr<MyActor>>,
|
||||||
|
) -> Result<impl Responder, Error> {
|
||||||
|
// `?` operator tests "actors" feature flag on actix-http
|
||||||
|
let res = addr.send(Num(1)).await?;
|
||||||
|
|
||||||
|
if res == 1 {
|
||||||
|
Ok(HttpResponse::Ok())
|
||||||
|
} else {
|
||||||
|
Ok(HttpResponse::BadRequest())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let srv = App::new()
|
||||||
|
.data(addr.clone())
|
||||||
|
.service(web::resource("/").to(actor_handler));
|
||||||
|
|
||||||
|
let mut app = init_service(srv).await;
|
||||||
|
|
||||||
|
let req = TestRequest::post().uri("/").to_request();
|
||||||
|
let res = app.call(req).await.unwrap();
|
||||||
|
assert!(res.status().is_success());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user