pub fn fork_request_payload(orig_payload: &mut Payload) -> Payload
Expand description

Returns an effectively cloned payload that supports streaming efficiently.

The cloned payload:

  • yields identical chunks;
  • does not poll ahead of the original;
  • does not poll significantly slower than the original;
  • receives an error signal if the original errors, but details are opaque to the copy.

If the payload is forked in one of the extractors used in a handler, then the original must be read in another extractor or else the request will hang.