Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

fix `cargo test wasmtime-wasi-http --no-default-features --features p3` (#12380)

Joel Dice4d755770a9dc
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 730ef0a197..677c71ca9b 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -416,6 +416,8 @@ jobs:
- name: wasmtime-wasi-http
checks: |
-p wasmtime-wasi-http --no-default-features
+ -p wasmtime-wasi-http --no-default-features --features p3
+ -p wasmtime-wasi-http --no-default-features --features p3 --all-targets
- name: wasmtime-wasi
checks: |
diff --git a/Cargo.lock b/Cargo.lock
index cc010bb75b..c500a30a27 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5110,6 +5110,7 @@ dependencies = [
"wasm-compose",
"wasmtime",
"wasmtime-wasi",
+ "wasmtime-wasi-http",
"wasmtime-wasi-io",
"webpki-roots",
]
diff --git a/crates/wasi-http/Cargo.toml b/crates/wasi-http/Cargo.toml
index f2c25fce70..6ffa9c7e0f 100644
--- a/crates/wasi-http/Cargo.toml
+++ b/crates/wasi-http/Cargo.toml
@@ -43,10 +43,11 @@ rustls = { workspace = true, optional = true }
webpki-roots = { workspace = true, optional = true }
[dev-dependencies]
+wasmtime-wasi-http = { path = ".", features = ['default-send-request'] }
test-programs-artifacts = { workspace = true }
test-log = { workspace = true }
tracing-subscriber = { workspace = true }
-wasmtime = { workspace = true, features = ['cranelift'] }
+wasmtime = { workspace = true, features = ['cranelift', 'anyhow'] }
tokio = { workspace = true, features = ['fs', 'macros'] }
futures = { workspace = true, default-features = false, features = ['alloc', 'async-await'] }
sha2 = "0.10.2"
diff --git a/crates/wasi-http/src/p3/conv.rs b/crates/wasi-http/src/p3/conv.rs
index f625148824..073380b0e7 100644
--- a/crates/wasi-http/src/p3/conv.rs
+++ b/crates/wasi-http/src/p3/conv.rs
@@ -25,6 +25,7 @@ impl ErrorCode {
}
/// Translate a [`hyper::Error`] to a wasi-http [ErrorCode] in the context of a response.
+ #[cfg(feature = "default-send-request")]
pub(crate) fn from_hyper_response_error(err: hyper::Error) -> Self {
if err.is_timeout() {
return ErrorCode::HttpResponseTimeout;