1 use test_programs::p3::wasi::http::types::{Method, Scheme};
2
3 struct Component;
4
5 test_programs::p3::export!(Component);
6
7 impl test_programs::p3::exports::wasi::cli::run::Guest for Component {
run() -> Result<(), ()>8 async fn run() -> Result<(), ()> {
9 let res = test_programs::p3::http::request(
10 Method::Other("bad\nmethod".to_owned()),
11 Scheme::Http,
12 "localhost:3000",
13 "/",
14 None,
15 None,
16 None,
17 None,
18 None,
19 )
20 .await;
21
22 // This error arises from input validation in the `set_method` function on `OutgoingRequest`.
23 assert_eq!(res.unwrap_err().to_string(), "failed to set method");
24 Ok(())
25 }
26 }
27
main()28 fn main() {}
29