StreamingBodyExt
123456789pub trait StreamingBodyExt { // Required methods fn append_trailer( &mut self, name: impl ToHeaderName, value: impl ToHeaderValue, ); fn finish_with_trailers(self, trailers: &HeaderMap) -> Result<(), Error>;}Extensions to the crate::http::body::StreamingBody type to support trailers.
Methods
append_trailer
View sourceAppend the given trailer name and value to this body.
Trailers will be sent once the body send is complete. This function will not discard any existing values for the trailer; this value will simply be appended to the set of existing values.
Stability
This is part of an experimental API that is subject to change or removal even in minor versions of this crate.
Parameters
- self: &mut Self
- name: impl ToHeaderName
- value: impl ToHeaderValue
finish_with_trailers
View sourceGet the trailers associated with this body.
Note that modifying this HeaderMap will have no effect on the trailers
for the body; in order to add trailers, you will need to use BodyExt::append_trailer.
If you need to remove a trailer, the only current mechanism to do so is to
create a fresh body, and then copy over the trailers you wish to maintain.
(If this inconvenient, please contact your Fastly support team, and mention
this shortcoming.)
Trailers
Trailers can be tricky to access. You must completely read all bytes from the body
before calling this function. The outermost Result reflects this requirement; if you
receive BodyHandleError::TrailersNotReady, there are potentially more bytes available
in the body that you must read.
Stability
This is part of an experimental API that is subject to change or removal even in minor versions of this crate.
Parameters
- self: Self
- trailers: &HeaderMap
Returns