-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* chore: convert wasi http cli test to component * fix(wasmtime-cli): wrong linker in wasi http * fix(wasmtime-cli): fix multiple functions added to linker We will allow shadowing in linker when using WASI HTTP in order to prevent the following error: > import of `wasi:clocks/wall-clock` defined twice * chore: update to latest io streams wit definition * chore: rename main function of core module prtest:full * fix(wasmtime-cli): add only http functions to linker * chore: add test building http request and response * chore: disable temporarily wasi http test Co-authored-by: Eduardo de Moura Rodrigues <16357187+eduardomourar@users.noreply.github.com>
- Loading branch information
1 parent
1750566
commit a14004b
Showing
7 changed files
with
75 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
crates/test-programs/wasi-http-tests/src/bin/outbound_request_response_build.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use wasi_http_tests::bindings::wasi::{cli::stdout::get_stdout, http::types as http_types}; | ||
|
||
fn print(msg: &[u8]) { | ||
let _ = get_stdout().blocking_write_and_flush(&msg); | ||
} | ||
|
||
fn main() { | ||
print("Called _start\n".as_bytes()); | ||
{ | ||
let headers = http_types::Headers::new(&[( | ||
"Content-Type".to_string(), | ||
"application/json".to_string().into_bytes(), | ||
)]); | ||
let request = http_types::OutgoingRequest::new( | ||
&http_types::Method::Get, | ||
None, | ||
Some(&http_types::Scheme::Https), | ||
Some("www.example.com"), | ||
&headers, | ||
); | ||
let outgoing_body = request.write().unwrap(); | ||
let request_body = outgoing_body.write().unwrap(); | ||
request_body | ||
.blocking_write_and_flush("request-body".as_bytes()) | ||
.unwrap(); | ||
} | ||
{ | ||
let headers = http_types::Headers::new(&[( | ||
"Content-Type".to_string(), | ||
"application/text".to_string().into_bytes(), | ||
)]); | ||
let response = http_types::OutgoingResponse::new(200, &headers); | ||
let outgoing_body = response.write().unwrap(); | ||
let response_body = outgoing_body.write().unwrap(); | ||
response_body | ||
.blocking_write_and_flush("response-body".as_bytes()) | ||
.unwrap(); | ||
} | ||
print("Done\n".as_bytes()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.