From 3c38acbf6ddbd5c72c7dd960f04bb27e41393c57 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 22 Nov 2023 09:18:03 +0900 Subject: [PATCH] fix: Call to an undefined method ------ -------------------------------------------------- Line system/HTTP/CURLRequest.php ------ -------------------------------------------------- 485 Call to an undefined method CodeIgniter\HTTP\ResponseInterface::addHeader(). ------ -------------------------------------------------- --- system/HTTP/CURLRequest.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/system/HTTP/CURLRequest.php b/system/HTTP/CURLRequest.php index 4c011c985f1d..35b62ec3486f 100644 --- a/system/HTTP/CURLRequest.php +++ b/system/HTTP/CURLRequest.php @@ -482,7 +482,11 @@ protected function setResponseHeaders(array $headers = []) $title = trim(substr($header, 0, $pos)); $value = trim(substr($header, $pos + 1)); - $this->response->addHeader($title, $value); + if ($this->response instanceof Response) { + $this->response->addHeader($title, $value); + } else { + $this->response->setHeader($title, $value); + } } elseif (strpos($header, 'HTTP') === 0) { preg_match('#^HTTP\/([12](?:\.[01])?) (\d+) (.+)#', $header, $matches);