Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Bump juniper_axum crate to axum 0.8 #1303

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions juniper_axum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ rustdoc-args = ["--cfg", "docsrs"]
subscriptions = ["axum/ws", "juniper_graphql_ws/graphql-ws", "dep:futures"]

[dependencies]
axum = { version = "0.7", features = ["json", "query"], default-features = false }
axum = { version = "=0.8.1", features = ["json", "query"], default-features = false }
futures = { version = "0.3.22", optional = true }
juniper = { version = "0.16", path = "../juniper", default-features = false }
juniper_graphql_ws = { version = "0.4.0", path = "../juniper_graphql_ws", features = ["graphql-transport-ws"] }
Expand All @@ -38,7 +38,7 @@ bytes = "1.2"

[dev-dependencies]
anyhow = "1.0"
axum = { version = "0.7", features = ["http1", "macros", "tokio"] }
axum = { version = "0.8", features = ["http1", "macros", "tokio"] }
futures = "0.3.22"
juniper = { version = "0.16", path = "../juniper", features = ["expose-test-schema"] }
tokio = { version = "1.20", features = ["macros", "net", "rt-multi-thread", "time"] }
Expand Down
2 changes: 0 additions & 2 deletions juniper_axum/src/extract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use std::fmt;

use axum::{
async_trait,
body::Body,
extract::{FromRequest, FromRequestParts, Query},
http::{header, HeaderValue, Method, Request, StatusCode},
Expand Down Expand Up @@ -70,7 +69,6 @@ pub struct JuniperRequest<S = DefaultScalarValue>(pub GraphQLBatchRequest<S>)
where
S: ScalarValue;

#[async_trait]
impl<S, State> FromRequest<State> for JuniperRequest<S>
where
S: ScalarValue,
Expand Down
4 changes: 2 additions & 2 deletions juniper_axum/src/subscriptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ where
Ok(match output {
graphql_transport_ws::Output::Message(msg) => {
serde_json::to_string(&msg)
.map(ws::Message::Text)
.map(ws::Message::text)
.unwrap_or_else(|e| {
ws::Message::Close(Some(ws::CloseFrame {
code: 1011, // CloseCode::Error
Expand Down Expand Up @@ -618,7 +618,7 @@ where
let output = s_rx
.map(|msg| {
Ok(serde_json::to_string(&msg)
.map(ws::Message::Text)
.map(ws::Message::text)
.unwrap_or_else(|e| {
ws::Message::Close(Some(ws::CloseFrame {
code: 1011, // CloseCode::Error
Expand Down
2 changes: 1 addition & 1 deletion juniper_axum/tests/ws_test_suite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl TestApp {
None => Err(anyhow!("No message received")),
Some(Err(e)) => Err(anyhow!("WebSocket error: {e}")),
Some(Ok(Message::Text(json))) => {
let actual: serde_json::Value = serde_json::from_str(&*json)
let actual: serde_json::Value = serde_json::from_str(&json)
.map_err(|e| anyhow!("Cannot deserialize received message: {e}"))?;
if actual != expected {
return Err(anyhow!(
Expand Down
Loading