Add Warning header to exception response

This commit is contained in:
Sebastian Meyer 2024-09-07 18:52:20 +02:00
parent 692ecdf96b
commit 93abe20cc3
1 changed files with 11 additions and 5 deletions

View File

@ -109,12 +109,18 @@ class QueueRequestHandler implements RequestHandler
'max_range' => 599 'max_range' => 599
] ]
]; ];
$statusCode = filter_var($exception->getCode(), FILTER_VALIDATE_INT, $options);
$this->response = new GuzzleResponse( $this->response = new GuzzleResponse(
$statusCode, filter_var($exception->getCode(), FILTER_VALIDATE_INT, $options),
[], [
'Warning' => [sprintf(
'Error %d in %s',
$exception->getCode(),
get_debug_type($middleware)
)]
],
sprintf( sprintf(
'Exception thrown in middleware %s: %s', 'Exception %d thrown in middleware %s: %s',
$exception->getCode(),
get_debug_type($middleware), get_debug_type($middleware),
$exception->getMessage() $exception->getMessage()
) )
@ -210,7 +216,7 @@ class QueueRequestHandler implements RequestHandler
{ {
$this->request = GuzzleRequest::fromGlobals(); $this->request = GuzzleRequest::fromGlobals();
$this->queue = MiddlewareQueue::getInstance($middlewares); $this->queue = MiddlewareQueue::getInstance($middlewares);
$this->response = new GuzzleResponse(200); $this->response = new GuzzleResponse();
} }
/** /**