Skip to content

Clarify consume-body error propagation for middleware - #953

Open
adamrk wants to merge 1 commit into
WebAssembly:mainfrom
adamrk:http-consume-body-middleware-error-docs
Open

adamrk wants to merge 1 commit into
WebAssembly:mainfrom
adamrk:http-consume-body-middleware-error-docs

Conversation

@adamrk

@adamrk adamrk commented Aug 14, 2026

Copy link
Copy Markdown

Add wording to the consume-body docs noting that middleware forwarding along a handler chain will typically want to connect the res future it passes in to the future returned by request.new / response.new, so the originator of the request or response is notified of errors that occur further down the chain.

The current docs for {request, response}.new say

The returned future resolves to result of transmission of this request.

and the docs for consume-body state

This function takes a res future as a parameter, which can be used to communicate an error in handling of the request.

I think with this wording it's natural for a middleware author to pass Ok as long as they are able to successfully hand the request/response to the next layer and to do so without being aware that the originator of the request/response now can't see the result of transmission to the destination (here is an example).

This change should make the situation clearer.

Add wording to the `consume-body` docs for both `request` and `response`
noting that middleware forwarding along a handler chain will typically
want to connect the `res` future it passes in to the future returned by
`request.new` / `response.new`, so the originator of the `request` or
`response` is notified of errors that occur further down the chain.
@adamrk
adamrk requested a review from a team as a code owner August 14, 2026 14:51
@github-actions github-actions Bot added the P-http Proposal: wasi-http label Aug 14, 2026
@pchickey pchickey mentioned this pull request Sep 28, 2026
11 of 50 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P-http Proposal: wasi-http

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant