Merge pull request #883 from alisenai/master
Update Axum integration to Axum 0.5.1
This commit is contained in:
commit
f1a3d6d3aa
2
examples
2
examples
|
@ -1 +1 @@
|
||||||
Subproject commit 6a63808523f7e4995f9111a3497f06921cd3b11b
|
Subproject commit ef09f81f6f348eb2ba4d24ec1dc4ed84b2ed684f
|
|
@ -15,7 +15,7 @@ categories = ["network-programming", "asynchronous"]
|
||||||
async-graphql = { path = "../..", version = "3.0.37" }
|
async-graphql = { path = "../..", version = "3.0.37" }
|
||||||
|
|
||||||
async-trait = "0.1.51"
|
async-trait = "0.1.51"
|
||||||
axum = { version = "0.4", features = ["ws", "headers"] }
|
axum = { version = "0.5.1", features = ["ws", "headers"] }
|
||||||
bytes = "1.0.1"
|
bytes = "1.0.1"
|
||||||
http-body = "0.4.2"
|
http-body = "0.4.2"
|
||||||
serde_json = "1.0.66"
|
serde_json = "1.0.66"
|
||||||
|
|
|
@ -106,7 +106,7 @@ where
|
||||||
} else {
|
} else {
|
||||||
let content_type = req
|
let content_type = req
|
||||||
.headers()
|
.headers()
|
||||||
.and_then(|headers| headers.get(http::header::CONTENT_TYPE))
|
.get(http::header::CONTENT_TYPE)
|
||||||
.and_then(|value| value.to_str().ok())
|
.and_then(|value| value.to_str().ok())
|
||||||
.map(ToString::to_string);
|
.map(ToString::to_string);
|
||||||
let body_stream = BodyStream::from_request(req)
|
let body_stream = BodyStream::from_request(req)
|
||||||
|
|
|
@ -29,7 +29,7 @@ impl<B: Send> FromRequest<B> for GraphQLProtocol {
|
||||||
|
|
||||||
async fn from_request(req: &mut RequestParts<B>) -> Result<Self, Self::Rejection> {
|
async fn from_request(req: &mut RequestParts<B>) -> Result<Self, Self::Rejection> {
|
||||||
req.headers()
|
req.headers()
|
||||||
.and_then(|headers| headers.get(http::header::SEC_WEBSOCKET_PROTOCOL))
|
.get(http::header::SEC_WEBSOCKET_PROTOCOL)
|
||||||
.and_then(|value| value.to_str().ok())
|
.and_then(|value| value.to_str().ok())
|
||||||
.and_then(|protocols| {
|
.and_then(|protocols| {
|
||||||
protocols
|
protocols
|
||||||
|
|
|
@ -91,8 +91,8 @@ pub async fn receive_batch_json(body: impl AsyncRead) -> Result<BatchRequest, Pa
|
||||||
body.read_to_end(&mut data)
|
body.read_to_end(&mut data)
|
||||||
.await
|
.await
|
||||||
.map_err(ParseRequestError::Io)?;
|
.map_err(ParseRequestError::Io)?;
|
||||||
Ok(serde_json::from_slice::<BatchRequest>(&data)
|
serde_json::from_slice::<BatchRequest>(&data)
|
||||||
.map_err(|e| ParseRequestError::InvalidRequest(Box::new(e)))?)
|
.map_err(|e| ParseRequestError::InvalidRequest(Box::new(e)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Receive a GraphQL request from a body as CBOR.
|
/// Receive a GraphQL request from a body as CBOR.
|
||||||
|
|
|
@ -38,7 +38,6 @@ impl<'a> Lookahead<'a> {
|
||||||
self.fragments,
|
self.fragments,
|
||||||
&field.selection_set.node,
|
&field.selection_set.node,
|
||||||
name,
|
name,
|
||||||
self.context,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +107,6 @@ fn filter<'a>(
|
||||||
fragments: &'a HashMap<Name, Positioned<FragmentDefinition>>,
|
fragments: &'a HashMap<Name, Positioned<FragmentDefinition>>,
|
||||||
selection_set: &'a SelectionSet,
|
selection_set: &'a SelectionSet,
|
||||||
name: &str,
|
name: &str,
|
||||||
context: &'a Context<'a>,
|
|
||||||
) {
|
) {
|
||||||
for item in &selection_set.items {
|
for item in &selection_set.items {
|
||||||
match &item.node {
|
match &item.node {
|
||||||
|
@ -122,7 +120,6 @@ fn filter<'a>(
|
||||||
fragments,
|
fragments,
|
||||||
&fragment.node.selection_set.node,
|
&fragment.node.selection_set.node,
|
||||||
name,
|
name,
|
||||||
context,
|
|
||||||
),
|
),
|
||||||
Selection::FragmentSpread(spread) => {
|
Selection::FragmentSpread(spread) => {
|
||||||
if let Some(fragment) = fragments.get(&spread.node.fragment_name.node) {
|
if let Some(fragment) = fragments.get(&spread.node.fragment_name.node) {
|
||||||
|
@ -131,7 +128,6 @@ fn filter<'a>(
|
||||||
fragments,
|
fragments,
|
||||||
&fragment.node.selection_set.node,
|
&fragment.node.selection_set.node,
|
||||||
name,
|
name,
|
||||||
context,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user