Bump actix-web from 4.0.0-beta.11
to 4.0.0-beta.14
This commit is contained in:
parent
05e0349a16
commit
d211b48a5b
2
examples
2
examples
|
@ -1 +1 @@
|
||||||
Subproject commit ad5a253197dff977eadd7afb6626036776a162b7
|
Subproject commit f9116e9029f6d57cea22c139c3e5fd952b774979
|
|
@ -14,9 +14,9 @@ categories = ["network-programming", "asynchronous"]
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-graphql = { path = "../..", version = "3.0.13" }
|
async-graphql = { path = "../..", version = "3.0.13" }
|
||||||
actix = "0.12.0"
|
actix = "0.12.0"
|
||||||
actix-http = "3.0.0-beta.12"
|
actix-http = "3.0.0-beta.15"
|
||||||
actix-web = { version = "4.0.0-beta.11", default-features = false }
|
actix-web = { version = "4.0.0-beta.14", default-features = false }
|
||||||
actix-web-actors = "4.0.0-beta.7"
|
actix-web-actors = "4.0.0-beta.8"
|
||||||
async-channel = "1.6.1"
|
async-channel = "1.6.1"
|
||||||
futures-util = { version = "0.3.17", default-features = false }
|
futures-util = { version = "0.3.17", default-features = false }
|
||||||
serde_json = "1.0.64"
|
serde_json = "1.0.64"
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use actix_http::body::BoxBody;
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::io::{self, ErrorKind};
|
use std::io::{self, ErrorKind};
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
|
@ -153,6 +154,8 @@ impl From<async_graphql::BatchResponse> for GraphQLResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Responder for GraphQLResponse {
|
impl Responder for GraphQLResponse {
|
||||||
|
type Body = BoxBody;
|
||||||
|
|
||||||
fn respond_to(self, _req: &HttpRequest) -> HttpResponse {
|
fn respond_to(self, _req: &HttpRequest) -> HttpResponse {
|
||||||
let mut res = HttpResponse::build(StatusCode::OK);
|
let mut res = HttpResponse::build(StatusCode::OK);
|
||||||
res.content_type("application/json");
|
res.content_type("application/json");
|
||||||
|
|
|
@ -114,7 +114,9 @@ where
|
||||||
continuation: Vec::new(),
|
continuation: Vec::new(),
|
||||||
};
|
};
|
||||||
|
|
||||||
actix_web_actors::ws::start_with_protocols(actor, &ALL_WEBSOCKET_PROTOCOLS, request, stream)
|
actix_web_actors::ws::WsResponseBuilder::new(actor, request, stream)
|
||||||
|
.protocols(&ALL_WEBSOCKET_PROTOCOLS)
|
||||||
|
.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use actix_http::Method;
|
use actix_http::Method;
|
||||||
use actix_web::dev::{AnyBody, Service};
|
use actix_web::dev::Service;
|
||||||
use actix_web::{guard, test, web, web::Data, App};
|
use actix_web::{guard, test, web, web::Data, App};
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
|
|
||||||
|
@ -21,12 +21,12 @@ async fn test_playground() {
|
||||||
let req = test::TestRequest::with_uri("/").to_request();
|
let req = test::TestRequest::with_uri("/").to_request();
|
||||||
let response = srv.call(req).await.unwrap();
|
let response = srv.call(req).await.unwrap();
|
||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
let body = response.response().body();
|
let body = response.into_body();
|
||||||
if let AnyBody::Bytes(bytes) = body {
|
assert!(
|
||||||
assert!(std::str::from_utf8(&bytes).unwrap().contains("graphql"));
|
std::str::from_utf8(&actix_web::body::to_bytes(body).await.unwrap())
|
||||||
} else {
|
.unwrap()
|
||||||
panic!("response body must be Bytes {:?}", body);
|
.contains("graphql")
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
|
@ -55,10 +55,10 @@ async fn test_add() {
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
let body = response.response().body();
|
let body = response.into_body();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
body,
|
actix_web::body::to_bytes(body).await.unwrap(),
|
||||||
&AnyBody::Bytes(json!({"data": {"add": 30}}).to_string().into_bytes().into())
|
json!({"data": {"add": 30}}).to_string().into_bytes()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,15 +89,12 @@ async fn test_hello() {
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
let body = response.response().body();
|
let body = response.into_body();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
body,
|
actix_web::body::to_bytes(body).await.unwrap(),
|
||||||
&AnyBody::Bytes(
|
json!({"data": {"hello": "Hello, world!"}})
|
||||||
json!({"data": {"hello": "Hello, world!"}})
|
.to_string()
|
||||||
.to_string()
|
.into_bytes()
|
||||||
.into_bytes()
|
|
||||||
.into()
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,15 +126,12 @@ async fn test_hello_header() {
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
let body = response.response().body();
|
let body = response.into_body();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
body,
|
actix_web::body::to_bytes(body).await.unwrap(),
|
||||||
&AnyBody::Bytes(
|
json!({"data": {"hello": "Hello, Foo!"}})
|
||||||
json!({"data": {"hello": "Hello, Foo!"}})
|
.to_string()
|
||||||
.to_string()
|
.into_bytes()
|
||||||
.into_bytes()
|
|
||||||
.into()
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,15 +162,10 @@ async fn test_count() {
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
let body = response.response().body();
|
let body = response.into_body();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
body,
|
actix_web::body::to_bytes(body).await.unwrap(),
|
||||||
&AnyBody::Bytes(
|
json!({"data": {"count": 0}}).to_string().into_bytes()
|
||||||
json!({"data": {"count": 0}})
|
|
||||||
.to_string()
|
|
||||||
.into_bytes()
|
|
||||||
.into()
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let response = srv
|
let response = srv
|
||||||
|
@ -189,15 +178,10 @@ async fn test_count() {
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
let body = response.response().body();
|
let body = response.into_body();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
body,
|
actix_web::body::to_bytes(body).await.unwrap(),
|
||||||
&AnyBody::Bytes(
|
json!({"data": {"addCount": 10}}).to_string().into_bytes(),
|
||||||
json!({"data": {"addCount": 10}})
|
|
||||||
.to_string()
|
|
||||||
.into_bytes()
|
|
||||||
.into()
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let response = srv
|
let response = srv
|
||||||
|
@ -210,15 +194,12 @@ async fn test_count() {
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
let body = response.response().body();
|
let body = response.into_body();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
body,
|
actix_web::body::to_bytes(body).await.unwrap(),
|
||||||
&AnyBody::Bytes(
|
json!({"data": {"subtractCount": 8}})
|
||||||
json!({"data": {"subtractCount": 8}})
|
.to_string()
|
||||||
.to_string()
|
.into_bytes()
|
||||||
.into_bytes()
|
|
||||||
.into()
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let response = srv
|
let response = srv
|
||||||
|
@ -231,14 +212,11 @@ async fn test_count() {
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
let body = response.response().body();
|
let body = response.into_body();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
body,
|
actix_web::body::to_bytes(body).await.unwrap(),
|
||||||
&AnyBody::Bytes(
|
json!({"data": {"subtractCount": 6}})
|
||||||
json!({"data": {"subtractCount": 6}})
|
.to_string()
|
||||||
.to_string()
|
.into_bytes()
|
||||||
.into_bytes()
|
|
||||||
.into()
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user