Repository navigation
wasi-http: Clean up run_http test helper - #15041
Merged
rvolosatovs merged 2 commits intoOct 30, 2026
Merged
Conversation
adamrk
requested review from
pchickey and
rvolosatovs
and removed request for
a team
October 28, 2026 01:20
This was referenced Oct 28, 2026
Merged
rvolosatovs
reviewed
Oct 29, 2026
|
|
||
| /// Like [`run_http`], but sends the request forwarded by the guest to one of | ||
| /// the `p3-test*` endpoints on `request_tx`. | ||
| async fn run_http_get_forwarded_request<E: Into<Error> + 'static>( |
Member
There was a problem hiding this comment.
could this name be shorter?
Maybe run_http_forwarded or something like that?
| // Respond immediately, collecting the request body in the | ||
| // background after the response is returned. | ||
| let request_tx = self.request_tx.take(); | ||
| tokio::spawn(collect_request(request, request_tx)); |
Member
There was a problem hiding this comment.
should we check/report errors here? Perhaps we should send a result over request_tx rather than just the collected request?
The `run_http` test helper currently takes a channel and sends the uncollected http request down that channel for the caller to see. But only a few tests actually use that and it can otherwise be difficult because the request body many never actually be read and a guest program can be left hanging if it awaits that. This change hopefully makes `run_http` more intuitive by not taking the channel and in general reading the full request body. The new version `run_http_get_forwarded_request` can be used if the caller needs to see how the request was passed along and the new endpoint `p3-test-immediate-response` can be used when the test needs a response to be sent without the body being read.
adamrk
force-pushed
the
abk/cleanup-run_http-test-helper
branch
from
October 29, 2026 19:17
4ecbd99 to
48aeac7
Compare
rvolosatovs
approved these changes
Oct 29, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
run_httptest helper currently takes a channel and sends the uncollected http request down that channel for the caller to see. But only a few tests actually use that and it can otherwise be difficult because the request body many never actually be read and a guest program can be left hanging if it awaits that.This change hopefully makes
run_httpmore intuitive by not taking the channel and in general reading the full request body. The new versionrun_http_get_forwarded_requestcan be used if the caller needs to see how the request was passed along and the new endpointp3-test-immediate-responsecan be used when the test needs a response to be sent without the body being read.