File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 66
77use Lmc \HttpConstants \Header ;
88use Neos \Flow \Annotations as Flow ;
9+ use Psr \Http \Message \ResponseFactoryInterface ;
910use Psr \Http \Message \ResponseInterface ;
1011use Psr \Http \Message \ServerRequestInterface ;
1112use Psr \Http \Server \MiddlewareInterface ;
1415
1516class CorsHeaderMiddleware implements MiddlewareInterface
1617{
18+ /**
19+ * @Flow\Inject
20+ * @var ResponseFactoryInterface
21+ */
22+ protected $ responseFactory ;
23+
1724 /**
1825 * @Flow\InjectConfiguration("enabled")
1926 */
@@ -73,15 +80,16 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
7380 }
7481
7582 $ this ->initializeConfiguration ();
76-
77- $ response = $ handler ->handle ($ request );
7883 $ method = $ request ->getMethod ();
7984
8085 // method type is not options, return early
8186 if ($ method == 'OPTIONS ' ) {
8287 $ this ->logger ->debug ('CORS Component: Preflight request ' );
88+ $ response = $ this ->responseFactory ->createResponse ();
8389 return $ this ->handlePreflight ($ request , $ response );
8490 }
91+
92+ $ response = $ handler ->handle ($ request );
8593 return $ this ->handleRequest ($ request , $ response );
8694 }
8795
You can’t perform that action at this time.
0 commit comments