fix error using a better way

This commit is contained in:
Beu
2025-08-27 21:37:37 +02:00
parent fd0a15cc61
commit 6af13da300
2 changed files with 3 additions and 5 deletions

View File

@@ -115,9 +115,7 @@ class RequestsQueue extends EventDispatcher implements RequestsQueueInterface, \
$event = new Event();
$event->request = $request;
$event->response = new Response($request, curl_multi_getcontent($request->getHandle()));
if ($event->request->getResponseHeaders() !== null) {
$event->response->setHeaders($event->request->getResponseHeaders());
}
$event->response->setHeaders($event->request->getResponseHeaders());
if ($result !== CURLE_OK) {
$event->response->setError(new Error(curl_error($request->getHandle()), $result));
}

View File

@@ -81,10 +81,10 @@ class Response
/**
* Sets headers
*
* @param array $error headers to set
* @param array|null $headers headers to set
* @return void
*/
public function setHeaders(array $headers)
public function setHeaders(?array $headers)
{
$this->headers = $headers;
}