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 4
4
5
5
namespace ReactParallel \Psr15Adapter ;
6
6
7
+ use Ancarda \Psr7 \StringStream \ReadOnlyStringStream ;
7
8
use parallel \Channel ;
8
9
use Psr \Http \Message \ResponseInterface ;
9
10
use Psr \Http \Message \ServerRequestInterface ;
@@ -39,14 +40,16 @@ public function __construct(
39
40
40
41
public function __invoke (ServerRequestInterface $ request , callable $ next ): PromiseInterface
41
42
{
43
+ $ request = $ request ->withBody (new ReadOnlyStringStream ((string ) $ request ->getBody ()));
44
+
42
45
return new Promise (function (callable $ resolve , callable $ reject ) use ($ request , $ next ): void {
43
46
$ input = new Channel (Channel::Infinite);
44
47
$ output = new Channel (Channel::Infinite);
45
48
46
49
$ this ->streamFactory ->single ($ output )->then (static function (string $ request ): ServerRequestInterface {
47
50
return unserialize ($ request );
48
51
}, $ reject )->then ($ next )->then (static function (ResponseInterface $ response ): string {
49
- return serialize ($ response );
52
+ return serialize ($ response-> withBody ( new ReadOnlyStringStream (( string ) $ response -> getBody ())) );
50
53
}, $ reject )->then (static function (string $ response ) use ($ input ): void {
51
54
$ input ->send ($ response );
52
55
}, $ reject );
You can’t perform that action at this time.
0 commit comments