Closed joelwurtz closed 8 years ago
Is it ok to merge ?
looks good to me. @Nyholm @sagikazarmark do you agree?
AFAIK there are some PSR7 compliance test suits out there. Maybe we should use them to test PSR7 implementations. If they are not good enough, maybe we could write one? Apart from that, LGTM.
👍
more testing is always good, but lets not hold up merging. @joelwurtz if you have time to check out the idea from mark, that would be great to detect issues before we release.
I only found https://github.com/Maks3w/Psr7Assertions but this does not test stream
I was once thinking about writting a PSR7 tester lib which accepts message factories to create messages/streams so that it can handle specific data and other options. The other possibility is to have an abstract method which returns a PSR7 object instance and that can be used since its immutable, although there would be some drawbacks like streams are noz immutable, etc.
This is a replacement for the MemoryCloner, this allow to decorate a not seekable stream with a seekable one.
In order to do that it buffer the underlying stream into a php://temp resource by default (but can also be fully buffered into memory).
It never reads the underlying stream, until it has been tell to do so.
Once this is merged i will add a EnsureSeekableStreamPlugin, which decorates the request body and the response body with this one if the existing stream is not seekable, so we would be able to get the stream content (format) even for not seekable stream (only if user want it).