Closed joelwurtz closed 8 years ago
What about memory usage in case of huge bodies? We should add a warning somewhere about that.
It's in the header of the MemoryClonedStream, by default it use a php://temp stream with a 2mb memory buffer, so the memory footprint of a cloned stream will, by default, have a max memory size of 2mb, when the body is higher, all data over the limit is written into a file.
I like this. It could help on all the places we do some ugly hack to rewind streams and make sure they are seekable.
@joelwurtz could you address the comments?
Finally i'm not a fan of this implementation, message cloner is useless and the cloned stream enforce stream reading where i'm not a fan, will do a better implementation for the wanted use case.
What's in this PR?
Add a class to copy a request including it's body
Why?
IMO cloning a request with its stream his something that is shared by some concepts (like logging, caching, ....)
Example Usage
Checklist