Skip to content

wasi-http: Pass transmission errors through middleware - #14147

Open
adamrk wants to merge 2 commits into
bytecodealliance:mainfrom
adamrk:middleware-pass-error
Open

wasi-http: Pass transmission errors through middleware#14147
adamrk wants to merge 2 commits into
bytecodealliance:mainfrom
adamrk:middleware-pass-error

Conversation

@adamrk

@adamrk adamrk commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

{request, response}.new return a future which can be used to detect if there has been an error sending the request or response. Any middleware needs to pass that result on as an argument to consume-body for errors to be passed through that layer. This PR modifies the middleware example to do that and also adds a test to check that the error does propagate through.

@adamrk
adamrk requested review from a team as code owners August 17, 2026 18:16
@adamrk
adamrk requested review from pchickey and removed request for a team August 17, 2026 18:16
@@ -120,6 +120,11 @@ impl exports::wasi::http::handler::Guest for Component {
.unwrap();
my_request.set_authority(authority.as_deref()).unwrap();

// Forward any transmission error back to the caller.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Forward any transmission error back to the caller.
// Forward completion or transmission error back to the caller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants