Skip to content

Commit 0945be1

Browse files
Upgrade warp crate from 0.3.2 to 0.4 version (#1343)
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kai Ren <[email protected]>
1 parent c8a1e66 commit 0945be1

File tree

5 files changed

+24
-18
lines changed

5 files changed

+24
-18
lines changed

juniper_hyper/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ where
116116
.await
117117
.map_err(GraphQLRequestError::BodyHyper)?;
118118

119-
let input = String::from_utf8(chunk.to_bytes().iter().cloned().collect())
120-
.map_err(GraphQLRequestError::BodyUtf8)?;
119+
let input =
120+
String::from_utf8(chunk.to_bytes().into()).map_err(GraphQLRequestError::BodyUtf8)?;
121121

122122
serde_json::from_str::<GraphQLBatchRequest<S>>(&input)
123123
.map_err(GraphQLRequestError::BodyJSONError)
@@ -135,8 +135,8 @@ where
135135
.await
136136
.map_err(GraphQLRequestError::BodyHyper)?;
137137

138-
let query = String::from_utf8(chunk.to_bytes().iter().cloned().collect())
139-
.map_err(GraphQLRequestError::BodyUtf8)?;
138+
let query =
139+
String::from_utf8(chunk.to_bytes().into()).map_err(GraphQLRequestError::BodyUtf8)?;
140140

141141
Ok(GraphQLBatchRequest::Single(GraphQLRequest::new(
142142
query, None, None,

juniper_warp/CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ All user visible changes to `juniper_warp` crate will be documented in this file
1010

1111
### BC Breaks
1212

13-
- Bumped up [MSRV] to 1.85. ([#1272], [todo])
13+
- Bumped up [MSRV] to 1.85. ([#1272], [1b1fc618])
14+
- Switched to [0.4 version][warp-0.4] of [`warp` crate]. ([#1343])
1415

1516
[#1272]: /../../pull/1272
16-
[todo]: /../../commit/todo
17+
[#1343]: /../../pull/1343
18+
[1b1fc618]: /../../commit/1b1fc61879ffdd640d741e187dc20678bf7ab295
19+
[warp-0.4]: https://github.com/seanmonstar/warp/blob/v0.4.0/CHANGELOG.md#v040-august-5-2025
1720

1821

1922

@@ -58,6 +61,7 @@ See [old CHANGELOG](/../../blob/juniper_warp-v0.7.0/juniper_warp/CHANGELOG.md).
5861

5962

6063
[`juniper` crate]: https://docs.rs/juniper
64+
[`warp` crate]: https://docs.rs/warp
6165
[graphql-transport-ws]: https://github.com/enisdenjo/graphql-ws/blob/v5.14.0/PROTOCOL.md
6266
[graphql-ws]: https://github.com/apollographql/subscriptions-transport-ws/blob/v0.11.0/PROTOCOL.md
6367
[MSRV]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field

juniper_warp/Cargo.toml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,27 @@ juniper_graphql_ws = { version = "0.4.0", path = "../juniper_graphql_ws", featur
3838
log = { version = "0.4", optional = true }
3939
serde_json = "1.0.18"
4040
tokio = { version = "1.0", features = ["rt"] }
41-
warp = { version = "0.3.2", default-features = false }
41+
warp = "0.4"
4242

4343
# Fixes for `minimal-versions` check.
4444
# TODO: Try remove on upgrade of `warp` crate.
45-
headers = "0.3.8"
45+
http-body-util = "0.1.2"
4646

4747
[dev-dependencies]
4848
async-stream = "0.3"
4949
env_logger = "0.11"
50-
futures = "0.3.22"
50+
http-body-util = "0.1"
5151
itertools = "0.14"
5252
juniper = { version = "0.16", path = "../juniper", features = ["expose-test-schema"] }
5353
log = "0.4"
5454
percent-encoding = "2.1"
5555
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
5656
url = "2.0"
57+
warp = { version = "0.4", features = ["test"] }
58+
59+
# Fixes for `minimal-versions` check.
60+
# TODO: Try remove on upgrade of `warp` crate.
61+
hyper-util = "0.1.12"
5762

5863
[lints.clippy]
5964
allow_attributes = "warn"

juniper_warp/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
// TODO: Try remove on upgrade of `warp` crate.
1010
mod for_minimal_versions_check_only {
11-
use headers as _;
11+
use http_body_util as _;
12+
#[cfg(test)]
13+
use hyper_util as _;
1214
}
1315

1416
mod response;

juniper_warp/tests/http_test_suite.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
#![expect(unused_crate_dependencies, reason = "integration tests")]
44

5-
use futures::TryStreamExt as _;
5+
use http_body_util::BodyExt as _;
66
use itertools::Itertools as _;
77
use juniper::{
88
EmptyMutation, EmptySubscription, RootNode,
@@ -122,13 +122,8 @@ async fn into_test_response(resp: reply::Response) -> TestResponse {
122122
})
123123
.unwrap_or_default();
124124

125-
let body = String::from_utf8(
126-
body.map_ok(|bytes| bytes.to_vec())
127-
.try_concat()
128-
.await
129-
.unwrap(),
130-
)
131-
.unwrap_or_else(|e| panic!("not UTF-8 body: {e}"));
125+
let body = String::from_utf8(body.collect().await.unwrap().to_bytes().into())
126+
.unwrap_or_else(|e| panic!("not UTF-8 body: {e}"));
132127

133128
TestResponse {
134129
status_code,

0 commit comments

Comments
 (0)