Skip to content

feat(util): introduce ErrorBody<D, E> - #179

Merged
cratelyn merged 2 commits into
masterfrom
error-body
Sep 8, 2026
Merged

feat(util): introduce ErrorBody<D, E>#179
cratelyn merged 2 commits into
masterfrom
error-body

Conversation

@cratelyn

@cratelyn cratelyn commented Sep 2, 2026

Copy link
Copy Markdown
Member

a common piece of boilerplate code that shows up in test coverage for
body middleware is an "error body". at the time of writing, three such
examples live in the test code for this respository. this commit
introduces a reusable error body to facilitate authoring such test
coverage.

this body yields an error once, and then proceeds to yield Ready(None)
when polled afterwards.

this body exposes a D generic to control the Body::Data frame type,
to permit this to be used in situations with various Buf
implementations.

a common piece of boilerplate code that shows up in test coverage for
body middleware is an "error body". at the time of writing, three such
examples live in the test code for this respository. this commit
introduces a reusable error body to facilitate authoring such test
coverage.

this body yields an error once, and then proceeds to yield `Ready(None)`
when polled afterwards.

this body exposes a `D` generic to control the `Body::Data` frame type,
to permit this to be used in situations with various `Buf`
implementations.

Signed-off-by: katelyn martin <git@katelyn.world>
@cratelyn
cratelyn marked this pull request as ready for review September 2, 2026 17:21
because type inference can get tripped up on the `Body::Data` type, add
an example showing the construction of an error body.

Signed-off-by: katelyn martin <git@katelyn.world>
Comment thread http-body-util/src/error.rs
@cratelyn
cratelyn requested a review from seanmonstar September 8, 2026 13:50
@cratelyn
cratelyn merged commit 805ef18 into master Sep 8, 2026
8 checks passed
@cratelyn
cratelyn deleted the error-body branch September 8, 2026 16:19
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