v0.1.2
- Features:
- Implemented
Reply
forResponse<impl Into<hyper::Body>
, allowing streaming response bodies. - Add
warp::body::stream()
filter to access the request body as animpl Stream
. - Add
warp::ws2()
as a more flexible websocket filter.- This allows passing other extracted values to the upgrade callback, such as a value from a header or path.
- Deprecates
warp::ws()
, andws2()
will becomews()
in 0.2.
- Add
warp::get2()
,warp::post2()
,warp::put2()
, andwarp::delete2()
as more standard method filters that are used via chaining instead of nesting.get()
,post()
,put()
, anddelete()
are deprecated, and the new versions will become them in 0.2.
- Add
Filter::unify()
for when a filter returnsEither<T, T>
, converting theEither
into the innerT
, regardless of which variant it was.-
This requires that both sides of the
Either
be the same type. -
This can be useful when extracting a value that might be present in different places of the request.
// Allow `MyId` to be a path parameter or a header... let id = warp::path::param::<MyId>() .or(warp::header::<MyId>()) .unify(); // A way of providing default values... let dnt = warp::header::<bool>("dnt") .or(warp::any().map(|| true)) .unify();
-
- Add
content-type
header automatically to replies fromfile
anddir
filters based on file extension. - Add
warp::head()
,warp::options()
, andwarp::patch()
as new Method filters. - Try to use OS blocksize in
warp::fs
filters.
- Implemented
- Fixes:
- Chaining filters that try to consume the request body will log that the body is already consumed, and return a
500 Internal Server Error
rejection.
- Chaining filters that try to consume the request body will log that the body is already consumed, and return a