Skip to content

Commit 077e496

Browse files
authored
Merge pull request #193 from WebAssembly/http-response-async-context
wasip3 http-response: Run in async context
2 parents 7c306c5 + 7abe295 commit 077e496

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

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],
@@ -44,7 +45,7 @@ fn test_headers_same(left: &Fields, right: &Fields) {
4445
assert_eq!(left.copy_all(), right.copy_all());
4546
}
4647

47-
fn main() {
48+
async fn test_response() {
4849
let headers = Fields::new();
4950
// No field-specific syntax checks.
5051
headers.append("content-type", b"!!!! invalid").unwrap();
@@ -58,3 +59,16 @@ fn main() {
5859
test_immutable_headers(&response.get_headers());
5960
test_headers_same(&response.get_headers(), &headers_copy);
6061
}
62+
63+
struct Component;
64+
export!(Component);
65+
impl exports::wasi::cli::run::Guest for Component {
66+
async fn run() -> Result<(), ()> {
67+
test_response().await;
68+
Ok(())
69+
}
70+
}
71+
72+
fn main() {
73+
unreachable!("main is a stub");
74+
}

0 commit comments

Comments
 (0)