Skip to content

Commit 7abe295

Browse files
committed
wasip3 http-response: Run in async context
Fixes #186.
1 parent 939b20d commit 7abe295

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

tests/rust/wasm32-wasip3/src/bin/http-response.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ wit_bindgen::generate!({
66
77
world test {
88
include wasi:http/imports@0.3.0-rc-2025-09-16;
9+
include wasi:cli/command@0.3.0-rc-2025-09-16;
910
}
1011
",
1112
additional_derives: [PartialEq, Eq, Hash, Clone],
@@ -46,7 +47,7 @@ fn test_headers_same(left: &Fields, right: &Fields) {
4647
assert_eq!(left.copy_all(), right.copy_all());
4748
}
4849

49-
fn main() {
50+
async fn test_response() {
5051
let headers = Fields::new();
5152
// No field-specific syntax checks.
5253
headers.append("content-type", b"!!!! invalid").unwrap();
@@ -60,3 +61,16 @@ fn main() {
6061
test_immutable_headers(&response.get_headers());
6162
test_headers_same(&response.get_headers(), &headers_copy);
6263
}
64+
65+
struct Component;
66+
export!(Component);
67+
impl exports::wasi::cli::run::Guest for Component {
68+
async fn run() -> Result<(), ()> {
69+
test_response().await;
70+
Ok(())
71+
}
72+
}
73+
74+
fn main() {
75+
unreachable!("main is a stub");
76+
}

0 commit comments

Comments
 (0)