/**
  * @param RequestInterface $request
  * @param \Closure $next
  * @return ResponseInterface
  */
 public function handle(RequestInterface $request, \Closure $next) : ResponseInterface
 {
     try {
         return $next($request);
     } catch (\Throwable $e) {
         $this->run->allowQuit(false);
         $this->run->sendHttpCode(false);
         $this->run->writeToOutput(false);
         return $this->responseFactory->createResponse($e->getCode() >= 400 ? $e->getCode() : 500)->append($this->run->handleException($e));
     }
 }
Beispiel #2
0
 /**
  * @test
  */
 public function canCreateResponseWithStatus()
 {
     $response = $this->factory->createResponse(500);
     $this->assertSame($response->getStatusCode(), 500);
 }