Upgrade actix-web
beta versions (#995)
This commit is contained in:
parent
f66296d618
commit
bc66a2d898
4 changed files with 28 additions and 21 deletions
docs/book/content/advanced
examples/actix_subscriptions
juniper_actix
|
@ -48,7 +48,7 @@ DataLoader caching does not replace Redis, Memcache, or any other shared applica
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-identity = "0.4.0-beta.2"
|
actix-identity = "0.4.0-beta.4"
|
||||||
actix-rt = "1.0"
|
actix-rt = "1.0"
|
||||||
actix-web = {version = "2.0", features = []}
|
actix-web = {version = "2.0", features = []}
|
||||||
juniper = { git = "https://github.com/graphql-rust/juniper" }
|
juniper = { git = "https://github.com/graphql-rust/juniper" }
|
||||||
|
|
|
@ -6,8 +6,8 @@ authors = ["Mihai Dinculescu <mihai.dinculescu@outlook.com>"]
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "4.0.0-beta.8"
|
actix-web = "4.0.0-beta.12"
|
||||||
actix-cors = "0.6.0-beta.2"
|
actix-cors = "0.6.0-beta.4"
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
env_logger = "0.9"
|
env_logger = "0.9"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
|
|
|
@ -13,10 +13,10 @@ subscriptions = ["juniper_graphql_ws", "tokio"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix = "0.12"
|
actix = "0.12"
|
||||||
actix-http = "3.0.0-beta.8"
|
actix-http = "3.0.0-beta.13"
|
||||||
http = "0.2.4"
|
http = "0.2.4"
|
||||||
actix-web = "4.0.0-beta.8"
|
actix-web = "4.0.0-beta.12"
|
||||||
actix-web-actors = "4.0.0-beta.6"
|
actix-web-actors = "4.0.0-beta.7"
|
||||||
|
|
||||||
juniper = { version = "0.15.7", path = "../juniper", default-features = false }
|
juniper = { version = "0.15.7", path = "../juniper", default-features = false }
|
||||||
juniper_graphql_ws = { version = "0.3.0", path = "../juniper_graphql_ws", optional = true }
|
juniper_graphql_ws = { version = "0.3.0", path = "../juniper_graphql_ws", optional = true }
|
||||||
|
@ -30,11 +30,11 @@ tokio = { version = "1.0", features = ["sync"], optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
actix-rt = "2"
|
actix-rt = "2"
|
||||||
actix-cors = "0.6.0-beta.2"
|
actix-cors = "0.6.0-beta.4"
|
||||||
actix-identity = "0.4.0-beta.2"
|
actix-identity = "0.4.0-beta.4"
|
||||||
tokio = "1.0"
|
tokio = "1.0"
|
||||||
async-stream = "0.3"
|
async-stream = "0.3"
|
||||||
actix-test = "0.1.0-beta.3"
|
actix-test = "0.1.0-beta.6"
|
||||||
|
|
||||||
juniper = { version = "0.15.7", path = "../juniper", features = ["expose-test-schema"] }
|
juniper = { version = "0.15.7", path = "../juniper", features = ["expose-test-schema"] }
|
||||||
|
|
||||||
|
|
|
@ -467,7 +467,14 @@ pub mod subscriptions {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use actix_http::body::AnyBody;
|
use actix_http::body::AnyBody;
|
||||||
use actix_web::{dev::ServiceResponse, http, http::header::CONTENT_TYPE, test, web::Data, App};
|
use actix_web::{
|
||||||
|
dev::ServiceResponse,
|
||||||
|
http,
|
||||||
|
http::header::CONTENT_TYPE,
|
||||||
|
test::{self, TestRequest},
|
||||||
|
web::Data,
|
||||||
|
App,
|
||||||
|
};
|
||||||
use juniper::{
|
use juniper::{
|
||||||
http::tests::{run_http_test_suite, HttpIntegration, TestResponse},
|
http::tests::{run_http_test_suite, HttpIntegration, TestResponse},
|
||||||
tests::fixtures::starwars::schema::{Database, Query},
|
tests::fixtures::starwars::schema::{Database, Query},
|
||||||
|
@ -509,7 +516,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
let mut app =
|
let mut app =
|
||||||
test::init_service(App::new().route("/", web::get().to(graphql_handler))).await;
|
test::init_service(App::new().route("/", web::get().to(graphql_handler))).await;
|
||||||
let req = test::TestRequest::get()
|
let req = TestRequest::get()
|
||||||
.uri("/")
|
.uri("/")
|
||||||
.append_header((ACCEPT, "text/html"))
|
.append_header((ACCEPT, "text/html"))
|
||||||
.to_request();
|
.to_request();
|
||||||
|
@ -525,7 +532,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
let mut app =
|
let mut app =
|
||||||
test::init_service(App::new().route("/", web::get().to(graphql_handler))).await;
|
test::init_service(App::new().route("/", web::get().to(graphql_handler))).await;
|
||||||
let req = test::TestRequest::get()
|
let req = TestRequest::get()
|
||||||
.uri("/")
|
.uri("/")
|
||||||
.append_header((ACCEPT, "text/html"))
|
.append_header((ACCEPT, "text/html"))
|
||||||
.to_request();
|
.to_request();
|
||||||
|
@ -550,7 +557,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
let mut app =
|
let mut app =
|
||||||
test::init_service(App::new().route("/", web::get().to(graphql_handler))).await;
|
test::init_service(App::new().route("/", web::get().to(graphql_handler))).await;
|
||||||
let req = test::TestRequest::get()
|
let req = TestRequest::get()
|
||||||
.uri("/")
|
.uri("/")
|
||||||
.append_header((ACCEPT, "text/html"))
|
.append_header((ACCEPT, "text/html"))
|
||||||
.to_request();
|
.to_request();
|
||||||
|
@ -566,7 +573,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
let mut app =
|
let mut app =
|
||||||
test::init_service(App::new().route("/", web::get().to(graphql_handler))).await;
|
test::init_service(App::new().route("/", web::get().to(graphql_handler))).await;
|
||||||
let req = test::TestRequest::get()
|
let req = TestRequest::get()
|
||||||
.uri("/")
|
.uri("/")
|
||||||
.append_header((ACCEPT, "text/html"))
|
.append_header((ACCEPT, "text/html"))
|
||||||
.to_request();
|
.to_request();
|
||||||
|
@ -589,7 +596,7 @@ mod tests {
|
||||||
EmptySubscription::<Database>::new(),
|
EmptySubscription::<Database>::new(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let req = test::TestRequest::post()
|
let req = TestRequest::post()
|
||||||
.append_header(("content-type", "application/json; charset=utf-8"))
|
.append_header(("content-type", "application/json; charset=utf-8"))
|
||||||
.set_payload(
|
.set_payload(
|
||||||
r##"{ "variables": null, "query": "{ hero(episode: NEW_HOPE) { name } }" }"##,
|
r##"{ "variables": null, "query": "{ hero(episode: NEW_HOPE) { name } }" }"##,
|
||||||
|
@ -625,7 +632,7 @@ mod tests {
|
||||||
EmptySubscription::<Database>::new(),
|
EmptySubscription::<Database>::new(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let req = test::TestRequest::get()
|
let req = TestRequest::get()
|
||||||
.append_header(("content-type", "application/json"))
|
.append_header(("content-type", "application/json"))
|
||||||
.uri("/?query=%7B%20hero%28episode%3A%20NEW_HOPE%29%20%7B%20name%20%7D%20%7D&variables=null")
|
.uri("/?query=%7B%20hero%28episode%3A%20NEW_HOPE%29%20%7B%20name%20%7D%20%7D&variables=null")
|
||||||
.to_request();
|
.to_request();
|
||||||
|
@ -663,7 +670,7 @@ mod tests {
|
||||||
EmptySubscription::<Database>::new(),
|
EmptySubscription::<Database>::new(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let req = test::TestRequest::post()
|
let req = TestRequest::post()
|
||||||
.append_header(("content-type", "application/json"))
|
.append_header(("content-type", "application/json"))
|
||||||
.set_payload(
|
.set_payload(
|
||||||
r##"[
|
r##"[
|
||||||
|
@ -705,7 +712,7 @@ mod tests {
|
||||||
pub struct TestActixWebIntegration;
|
pub struct TestActixWebIntegration;
|
||||||
|
|
||||||
impl TestActixWebIntegration {
|
impl TestActixWebIntegration {
|
||||||
fn make_request(&self, req: test::TestRequest) -> TestResponse {
|
fn make_request(&self, req: TestRequest) -> TestResponse {
|
||||||
actix_web::rt::System::new().block_on(async move {
|
actix_web::rt::System::new().block_on(async move {
|
||||||
let schema = Schema::new(
|
let schema = Schema::new(
|
||||||
Query,
|
Query,
|
||||||
|
@ -728,12 +735,12 @@ mod tests {
|
||||||
|
|
||||||
impl HttpIntegration for TestActixWebIntegration {
|
impl HttpIntegration for TestActixWebIntegration {
|
||||||
fn get(&self, url: &str) -> TestResponse {
|
fn get(&self, url: &str) -> TestResponse {
|
||||||
self.make_request(test::TestRequest::get().uri(url))
|
self.make_request(TestRequest::get().uri(url))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn post_json(&self, url: &str, body: &str) -> TestResponse {
|
fn post_json(&self, url: &str, body: &str) -> TestResponse {
|
||||||
self.make_request(
|
self.make_request(
|
||||||
test::TestRequest::post()
|
TestRequest::post()
|
||||||
.append_header(("content-type", "application/json"))
|
.append_header(("content-type", "application/json"))
|
||||||
.set_payload(body.to_string())
|
.set_payload(body.to_string())
|
||||||
.uri(url),
|
.uri(url),
|
||||||
|
@ -742,7 +749,7 @@ mod tests {
|
||||||
|
|
||||||
fn post_graphql(&self, url: &str, body: &str) -> TestResponse {
|
fn post_graphql(&self, url: &str, body: &str) -> TestResponse {
|
||||||
self.make_request(
|
self.make_request(
|
||||||
test::TestRequest::post()
|
TestRequest::post()
|
||||||
.append_header(("content-type", "application/graphql"))
|
.append_header(("content-type", "application/graphql"))
|
||||||
.set_payload(body.to_string())
|
.set_payload(body.to_string())
|
||||||
.uri(url),
|
.uri(url),
|
||||||
|
|
Loading…
Add table
Reference in a new issue