Skip to content

Commit

Permalink
Update dependencies (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
devashishdxt authored Feb 3, 2025
1 parent a7388b2 commit 64f2b8f
Show file tree
Hide file tree
Showing 12 changed files with 63 additions and 70 deletions.
26 changes: 13 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ keywords = ["grpc", "grpc-web", "tonic", "wasm"]
edition = "2021"

[dependencies]
base64 = "0.22.0"
byteorder = "1.5.0"
bytes = "1.5.0"
futures-util = { version = "0.3.30", default-features = false }
base64 = "0.22"
byteorder = "1"
bytes = "1"
futures-util = { version = "0.3", default-features = false }
http = "1"
http-body = "1"
http-body-util = "0.1"
httparse = "1.8.0"
js-sys = "0.3.69"
pin-project = "1.1.5"
thiserror = "1.0.57"
httparse = "1"
js-sys = "0.3"
pin-project = "1"
thiserror = "1"
tonic = { version = "0.12", default-features = false }
tower-service = "0.3.2"
wasm-bindgen = "0.2.92"
wasm-bindgen-futures = "0.4.42"
wasm-streams = "0.4.0"
web-sys = { version = "0.3.69", features = [
tower-service = "0.3"
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
wasm-streams = "0.4"
web-sys = { version = "0.3", features = [
"Headers",
"ReadableStream",
"ReferrerPolicy",
Expand Down
12 changes: 7 additions & 5 deletions src/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,14 @@ fn prepare_request(
headers: Headers,
body: Option<JsValue>,
) -> Result<web_sys::Request, Error> {
let mut init = RequestInit::new();
let init = RequestInit::new();

init.method("POST")
.headers(headers.as_ref())
.body(body.as_ref())
.credentials(RequestCredentials::SameOrigin);
init.set_method("POST");
init.set_headers(headers.as_ref());
if let Some(ref body) = body {
init.set_body(body);
}
init.set_credentials(RequestCredentials::SameOrigin);

web_sys::Request::new_with_str_and_init(url, &init).map_err(Error::js_error)
}
Expand Down
16 changes: 8 additions & 8 deletions src/options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,34 +82,34 @@ impl FetchOptions {

impl From<FetchOptions> for RequestInit {
fn from(value: FetchOptions) -> Self {
let mut init = RequestInit::new();
let init = RequestInit::new();

if let Some(cache) = value.cache {
init.cache(cache.into());
init.set_cache(cache.into());
}

if let Some(credentials) = value.credentials {
init.credentials(credentials.into());
init.set_credentials(credentials.into());
}

if let Some(ref integrity) = value.integrity {
init.integrity(integrity);
init.set_integrity(integrity);
}

if let Some(mode) = value.mode {
init.mode(mode.into());
init.set_mode(mode.into());
}

if let Some(redirect) = value.redirect {
init.redirect(redirect.into());
init.set_redirect(redirect.into());
}

if let Some(ref referrer) = value.referrer {
init.referrer(referrer);
init.set_referrer(referrer);
}

if let Some(referrer_policy) = value.referrer_policy {
init.referrer_policy(referrer_policy.into());
init.set_referrer_policy(referrer_policy.into());
}

init
Expand Down
2 changes: 1 addition & 1 deletion test-suite/gzip/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ tonic-build = { version = "0.12", default-features = false, features = [

[dev-dependencies]
tonic-web-wasm-client = { path = "../../.." }
wasm-bindgen-test = "0.3.42"
wasm-bindgen-test = "0.3"
2 changes: 1 addition & 1 deletion test-suite/gzip/client/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ fn main() -> io::Result<()> {
tonic_build::configure()
.build_server(false)
.build_client(true)
.compile(&["echo.proto"], &["../proto"])
.compile_protos(&["echo.proto"], &["../proto"])
}
18 changes: 8 additions & 10 deletions test-suite/gzip/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
futures-core = "0.3.30"
http = "0.2.11"
prost = "0.12.3"
tokio = { version = "1.36.0", features = ["macros", "rt-multi-thread"] }
tonic = { version = "0.11.0", features = ["gzip"] }
tonic-web = "0.11.0"
tower-http = { version = "0.4.4", default-features = false, features = [
"cors",
] }
futures-core = "0.3"
http = "1"
prost = "0.13"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
tonic = { version = "0.12", features = ["gzip"] }
tonic-web = "0.12"
tower-http = { version = "0.6", default-features = false, features = ["cors"] }

[build-dependencies]
tonic-build = "0.11.0"
tonic-build = "0.12"
2 changes: 1 addition & 1 deletion test-suite/gzip/server/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ fn main() -> io::Result<()> {
tonic_build::configure()
.build_server(true)
.build_client(false)
.compile(&["echo.proto"], &["../proto"])
.compile_protos(&["echo.proto"], &["../proto"])
}
2 changes: 1 addition & 1 deletion test-suite/simple/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ tonic-build = { version = "0.12", default-features = false, features = [

[dev-dependencies]
tonic-web-wasm-client = { path = "../../.." }
wasm-bindgen-test = "0.3.42"
wasm-bindgen-test = "0.3"
2 changes: 1 addition & 1 deletion test-suite/simple/client/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ fn main() -> io::Result<()> {
tonic_build::configure()
.build_server(false)
.build_client(true)
.compile(&["echo.proto"], &["../proto"])
.compile_protos(&["echo.proto"], &["../proto"])
}
18 changes: 8 additions & 10 deletions test-suite/simple/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
futures-core = "0.3.30"
http = "0.2.11"
prost = "0.12.3"
tokio = { version = "1.36.0", features = ["macros", "rt-multi-thread"] }
tonic = "0.11.0"
tonic-web = "0.11.0"
tower-http = { version = "0.4.4", default-features = false, features = [
"cors",
] }
futures-core = "0.3"
http = "1"
prost = "0.13"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
tonic = "0.12"
tonic-web = "0.12"
tower-http = { version = "0.6", default-features = false, features = ["cors"] }

[build-dependencies]
tonic-build = "0.11.0"
tonic-build = "0.12"
2 changes: 1 addition & 1 deletion test-suite/simple/server/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ fn main() -> io::Result<()> {
tonic_build::configure()
.build_server(true)
.build_client(false)
.compile(&["echo.proto"], &["../proto"])
.compile_protos(&["echo.proto"], &["../proto"])
}
31 changes: 13 additions & 18 deletions test-suite/simple/server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,17 @@ impl Stream for InfiniteMessageStream {
}

const DEFAULT_MAX_AGE: Duration = Duration::from_secs(24 * 60 * 60);
const DEFAULT_EXPOSED_HEADERS: [&str; 3] =
["grpc-status", "grpc-message", "grpc-status-details-bin"];
const DEFAULT_ALLOW_HEADERS: [&str; 4] =
["x-grpc-web", "content-type", "x-user-agent", "grpc-timeout"];
const DEFAULT_EXPOSED_HEADERS: [HeaderName; 3] = [
HeaderName::from_static("grpc-status"),
HeaderName::from_static("grpc-message"),
HeaderName::from_static("grpc-status-details-bin"),
];
const DEFAULT_ALLOW_HEADERS: [HeaderName; 4] = [
HeaderName::from_static("x-grpc-web"),
HeaderName::from_static("content-type"),
HeaderName::from_static("x-user-agent"),
HeaderName::from_static("grpc-timeout"),
];

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
Expand All @@ -124,20 +131,8 @@ async fn main() -> Result<(), Box<dyn Error>> {
.allow_origin(AllowOrigin::mirror_request())
.allow_credentials(true)
.max_age(DEFAULT_MAX_AGE)
.expose_headers(
DEFAULT_EXPOSED_HEADERS
.iter()
.cloned()
.map(HeaderName::from_static)
.collect::<Vec<HeaderName>>(),
)
.allow_headers(
DEFAULT_ALLOW_HEADERS
.iter()
.cloned()
.map(HeaderName::from_static)
.collect::<Vec<HeaderName>>(),
),
.expose_headers(DEFAULT_EXPOSED_HEADERS)
.allow_headers(DEFAULT_ALLOW_HEADERS),
)
.layer(GrpcWebLayer::new())
.add_service(echo)
Expand Down

0 comments on commit 64f2b8f

Please sign in to comment.