Open BackEndTea opened 1 year ago
This is expected behavior as per PSR interface getContents()
is stream pointer aware:
Returns the remaining contents in a string
For multiple invocations of getContents()
stream must be rewound. It can not be rewound if it is not seekable.
Previous implementation was bugged. See #150
Reopening as documentation issue. Mention of behavior fix can be added to migration guide.
Thanks, ill try snd update the docs tomorrow
BC Break Report
Summary
In v2, the default the default behaviour of the
ServerRequestyFActory
was to return a request object, where you could get the contents of the body multiple times. in v3, every new read of getContents() will result in an empty string. (Casting the body to a string still works as before).Since the way it currently works is correct according to PSR implementation, it should probably be updated in the migration guide. And it should not be changed back to the v2 implementation
Previous behavior
getBody->getContents would return the full stream every time
Current behavior
getBody->getContents will return the full stream the first time, and then an empty string on consecutive calls.
How to reproduce
Send a post request and call request->getBody()->getContents() multiple times.