-
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.
wasi-http: Migrate to more descriptive error variant (#7434)
* Migrate to a more specific error-code variant in wasi-http Co-authored-by: Pat Hickey <[email protected]> * Optional fields, and align with upstream pr * Update for upstream changes to the error-code variant * Sync with the upstream implementation * Missed updating an error for riscv64 and s390x * More debuggable error prtest:full * Try to stabilize the test on windows --------- Co-authored-by: Pat Hickey <[email protected]>
- Loading branch information
Showing
17 changed files
with
359 additions
and
248 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
17 changes: 7 additions & 10 deletions
17
crates/test-programs/src/bin/http_outbound_request_invalid_version.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 |
---|---|---|
@@ -1,17 +1,14 @@ | ||
use test_programs::wasi::http::types::{Method, Scheme}; | ||
use test_programs::wasi::http::types::{ErrorCode, Method, Scheme}; | ||
|
||
fn main() { | ||
let addr = std::env::var("HTTP_SERVER").unwrap(); | ||
let res = | ||
test_programs::http::request(Method::Connect, Scheme::Http, &addr, "/", None, Some(&[])); | ||
|
||
let error = res.unwrap_err().to_string(); | ||
if !error.starts_with("Error::ProtocolError(\"") { | ||
panic!( | ||
r#"assertion failed: `(left == right)` | ||
left: `"{error}"`, | ||
right: `"Error::ProtocolError(\"invalid HTTP version parsed\")"` | ||
or `"Error::ProtocolError(\"operation was canceled\")"`)"# | ||
) | ||
} | ||
assert!(matches!( | ||
res.unwrap_err() | ||
.downcast::<ErrorCode>() | ||
.expect("expected a wasi-http ErrorCode"), | ||
ErrorCode::HttpProtocolError, | ||
)); | ||
} |
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 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
Oops, something went wrong.