Skip to content

Commit 1a24191

Browse files
committed
fix(http-client): expose types to allow naming HttpClient with middleware
Re-exports RpcService, HttpBackend, HttpTransportClient, RpcLogger, RpcLoggerLayer, RpcServiceBuilder, and RpcServiceT at the crate root so users can name the HttpClient type when middleware is applied. Also enables serde/alloc feature across workspace crates for no-default-features compatibility, and updates trybuild stderr fixtures for rustc 1.92.0. Closes #1590
1 parent bb3c537 commit 1a24191

File tree

10 files changed

+16
-12
lines changed

10 files changed

+16
-12
lines changed

client/http-client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jsonrpsee-types = { workspace = true }
2626
jsonrpsee-core = { workspace = true, features = ["client", "http-helpers"] }
2727
rustls = { workspace = true, optional = true, features = ["logging", "std", "tls12", "ring"] }
2828
rustls-platform-verifier = { workspace = true, optional = true }
29-
serde = { workspace = true }
29+
serde = { workspace = true, features = ["alloc"] }
3030
serde_json = { workspace = true }
3131
thiserror = { workspace = true }
3232
tokio = { workspace = true, features = ["time"] }

client/http-client/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ pub type HttpRequest<T = HttpBody> = jsonrpsee_core::http_helpers::Request<T>;
5757
/// HTTP response with default body.
5858
pub type HttpResponse<T = HttpBody> = jsonrpsee_core::http_helpers::Response<T>;
5959

60+
pub use jsonrpsee_core::middleware::layer::{RpcLogger, RpcLoggerLayer};
61+
pub use jsonrpsee_core::middleware::{RpcServiceBuilder, RpcServiceT};
62+
pub use transport::{HttpBackend, HttpTransportClient};
63+
6064
/// Custom TLS configuration.
6165
#[cfg(feature = "tls")]
6266
pub type CustomCertStore = rustls::ClientConfig;

client/ws-client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ tracing-subscriber = { workspace = true }
2929
jsonrpsee-test-utils = { path = "../../test-utils" }
3030
tokio = { workspace = true, features = ["macros"] }
3131
serde_json = { workspace = true }
32-
serde = { workspace = true }
32+
serde = { workspace = true, features = ["alloc"] }
3333
rustls = { workspace = true, features = ["logging", "std", "tls12", "ring"] }
3434

3535
[features]

core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ workspace = true
2020
async-trait = { workspace = true }
2121
jsonrpsee-types = { workspace = true }
2222
thiserror = { workspace = true }
23-
serde = { workspace = true }
23+
serde = { workspace = true, features = ["alloc"] }
2424
serde_json = { workspace = true, features = ["std", "raw_value"] }
2525
tracing = { workspace = true }
2626

proc-macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ hyper-util = { workspace = true, features = ["client", "client-legacy"]}
3333
futures-channel = { workspace = true }
3434
futures-util = { workspace = true }
3535
serde_json = { workspace = true }
36-
serde = { workspace = true }
36+
serde = { workspace = true, features = ["alloc"] }
3737
trybuild = { workspace = true }
3838
tokio = { workspace = true, features = ["rt", "macros"] }
3939
tower = { workspace = true }
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
error: use of deprecated method `DeprecatedClient::async_method`: please use `new_method` instead
2-
--> $DIR/rpc_deprecated_method.rs:63:20
2+
--> tests/ui/incorrect/rpc/rpc_deprecated_method.rs:63:20
33
|
44
63 | assert_eq!(client.async_method().await.unwrap(), 16);
55
| ^^^^^^^^^^^^
66
|
77
note: the lint level is defined here
8-
--> $DIR/rpc_deprecated_method.rs:4:9
8+
--> tests/ui/incorrect/rpc/rpc_deprecated_method.rs:4:9
99
|
10-
4 | #![deny(warnings)]
10+
4 | #![deny(warnings)]
1111
| ^^^^^^^^
1212
= note: `#[deny(deprecated)]` implied by `#[deny(warnings)]`

proc-macros/tests/ui/incorrect/rpc/rpc_empty_bounds.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0277]: the trait bound `<Conf as Config>::Hash: DeserializeOwned` is not satisfied
1+
error[E0277]: the trait bound `<Conf as Config>::Hash: serde::de::DeserializeOwned` is not satisfied
22
--> tests/ui/incorrect/rpc/rpc_empty_bounds.rs:9:1
33
|
44
9 | #[rpc(server, client, namespace = "foo", client_bounds(), server_bounds())]
@@ -15,7 +15,7 @@ note: required by a bound in `request`
1515
| ^^^^^^^^^^^^^^^^ required by this bound in `ClientT::request`
1616
= note: this error originates in the attribute macro `rpc` (in Nightly builds, run with -Z macro-backtrace for more info)
1717

18-
error[E0277]: the trait bound `<Conf as Config>::Hash: Serialize` is not satisfied
18+
error[E0277]: the trait bound `<Conf as Config>::Hash: serde::Serialize` is not satisfied
1919
--> tests/ui/incorrect/rpc/rpc_empty_bounds.rs:9:1
2020
|
2121
9 | #[rpc(server, client, namespace = "foo", client_bounds(), server_bounds())]

test-utils/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ hyper = { workspace = true }
1313
hyper-util = { workspace = true, features = ["server-auto", "tokio", "client-legacy"] }
1414
http-body-util = { workspace = true }
1515
tracing = { workspace = true }
16-
serde = { workspace = true, features = ["derive"] }
16+
serde = { workspace = true, features = ["derive", "alloc"] }
1717
serde_json = { workspace = true }
1818
soketto = { workspace = true, features = ["http"] }
1919
tokio = { workspace = true, features = ["net", "rt-multi-thread", "macros", "time"] }

tests/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ hyper = { workspace = true }
2020
hyper-util = { workspace = true, features = ["http1", "client", "client-legacy"] }
2121
jsonrpsee = { path = "../jsonrpsee", features = ["server", "client-core", "http-client", "ws-client", "macros"] }
2222
jsonrpsee-test-utils = { path = "../test-utils" }
23-
serde = { workspace = true }
23+
serde = { workspace = true, features = ["alloc"] }
2424
serde_json = { workspace = true }
2525
tokio = { workspace = true, features = ["rt-multi-thread", "time"] }
2626
tokio-stream = { workspace = true }

types/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ workspace = true
1818

1919
[dependencies]
2020
http = { workspace = true }
21-
serde = { workspace = true }
21+
serde = { workspace = true, features = ["alloc"] }
2222
serde_json = { workspace = true }
2323
thiserror = { workspace = true }

0 commit comments

Comments
 (0)