Exemple #1
0
 /**
  * {@inheritdoc}
  */
 public function handle(ServerRequestInterface $request, ResponseInterface $response = null) : ResponseInterface
 {
     // Passes the request to the container
     $this->app->instance(ServerRequestInterface::class, $request);
     StaticalProxy::clearResolvedInstance('request');
     $this->events->trigger(self::REQUEST, [$request]);
     if ($response === null) {
         $response = (new ResponseFactory())->createResponse();
     }
     $this->app->instance(ResponseInterface::class, $response);
     StaticalProxy::clearResolvedInstance('response');
     $response = $this->handleRequest($request, $response);
     // stop PHP sending a Content-Type automatically
     ini_set('default_mimetype', '');
     return $response;
 }