Skip to content

Conversation

@kaj
Copy link
Contributor

@kaj kaj commented Oct 18, 2025

In warp 0.3 there was a convenient converter from a static byte slice to a response body, so this fixes a minor regression.

Since warp 0.4 has such converters for String, &str, and Vec<u8>, I think it would be reasonable to have such a converter for &[u8] as well.

Alternatives

It would be possible to add a generic impl<T: Into<Bytes>> From<T> for Body instead. But perhaps that would have confusing side effects?

Of course, the using create could also make the conversion though Bytes, but since warp does not re-export it the calling crate would then need a direct dependency on bytes.

@kaj
Copy link
Contributor Author

kaj commented Oct 18, 2025

I believe the CI failure is unrelated, and fixed in #1142 .

Edit: Yes, I rebased and now the tests pass.

In warp 0.3 there was a convenient converter from a static byte slice
to response body.

Since warp 0.4 has sucn converters for `String`, `&str`, and
`Vec<u8>`, I think it would be reasonable to have such a converter for
`&[u8]` as well.
@kaj kaj force-pushed the body-from-static-u8s branch from 7b51315 to 0d288ad Compare October 19, 2025 09:20
@seanmonstar seanmonstar merged commit 3449d3d into seanmonstar:master Oct 20, 2025
10 checks passed
@kaj kaj deleted the body-from-static-u8s branch October 20, 2025 22:34
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