File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 44
55namespace ReactParallel \Psr15Adapter ;
66
7+ use Ancarda \Psr7 \StringStream \ReadOnlyStringStream ;
78use parallel \Channel ;
89use Psr \Http \Message \ResponseInterface ;
910use Psr \Http \Message \ServerRequestInterface ;
@@ -39,14 +40,16 @@ public function __construct(
3940
4041 public function __invoke (ServerRequestInterface $ request , callable $ next ): PromiseInterface
4142 {
43+ $ request = $ request ->withBody (new ReadOnlyStringStream ((string ) $ request ->getBody ()));
44+
4245 return new Promise (function (callable $ resolve , callable $ reject ) use ($ request , $ next ): void {
4346 $ input = new Channel (Channel::Infinite);
4447 $ output = new Channel (Channel::Infinite);
4548
4649 $ this ->streamFactory ->single ($ output )->then (static function (string $ request ): ServerRequestInterface {
4750 return unserialize ($ request );
4851 }, $ reject )->then ($ next )->then (static function (ResponseInterface $ response ): string {
49- return serialize ($ response );
52+ return serialize ($ response-> withBody ( new ReadOnlyStringStream (( string ) $ response -> getBody ())) );
5053 }, $ reject )->then (static function (string $ response ) use ($ input ): void {
5154 $ input ->send ($ response );
5255 }, $ reject );
You can’t perform that action at this time.
0 commit comments