10
10
use Stack \Builder ;
11
11
use Symfony \Component \HttpFoundation \Request as SymfonyRequest ;
12
12
use Symfony \Component \HttpFoundation \Response as SymfonyResponse ;
13
+ use Symfony \Component \HttpFoundation \StreamedResponse as SymfonyStreamedResponse ;
13
14
14
15
class HttpKernel implements BridgeInterface
15
16
{
@@ -36,10 +37,10 @@ class HttpKernel implements BridgeInterface
36
37
*/
37
38
public function bootstrap ($ appBootstrap , $ appenv )
38
39
{
39
- // include applications autoload
40
+ // include applications autoload
40
41
$ autoloader = dirname (realpath ($ _SERVER ['SCRIPT_NAME ' ])) . '/vendor/autoload.php ' ;
41
42
if (file_exists ($ autoloader )) {
42
- require_once $ autoloader ;
43
+ require_once $ autoloader ;
43
44
}
44
45
45
46
if (false === class_exists ($ appBootstrap )) {
@@ -145,6 +146,18 @@ protected static function mapResponse(ReactResponse $reactResponse,
145
146
{
146
147
$ headers = $ syResponse ->headers ->all ();
147
148
$ reactResponse ->writeHead ($ syResponse ->getStatusCode (), $ headers );
148
- $ reactResponse ->end ($ syResponse ->getContent ());
149
+
150
+ // @TODO convert StreamedResponse in an async manner
151
+ if ($ syResponse instanceof SymfonyStreamedResponse) {
152
+ ob_start ();
153
+ $ syResponse ->sendContent ();
154
+ $ content = ob_get_contents ();
155
+ ob_end_clean ();
156
+ }
157
+ else {
158
+ $ content = $ syResponse ->getContent ();
159
+ }
160
+
161
+ $ reactResponse ->end ($ content );
149
162
}
150
163
}
0 commit comments