mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-25 23:04:51 +02:00
Merge branch 'bugfix/preserve-http-response-code-in-rest-error-responses-12583'
fixes #12583
This commit is contained in:
commit
8bc7d47a62
@ -210,9 +210,11 @@ class Response extends Zend_Controller_Response_Http
|
|||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
public static function json()
|
public function json()
|
||||||
{
|
{
|
||||||
return new JsonResponse();
|
$response = new JsonResponse();
|
||||||
|
$response->copyMetaDataFrom($this);
|
||||||
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -292,4 +294,20 @@ class Response extends Zend_Controller_Response_Http
|
|||||||
}
|
}
|
||||||
return parent::sendHeaders();
|
return parent::sendHeaders();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies non-body-related response data from $response
|
||||||
|
*
|
||||||
|
* @param Response $response
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
protected function copyMetaDataFrom(self $response)
|
||||||
|
{
|
||||||
|
$this->_headers = $response->_headers;
|
||||||
|
$this->_headersRaw = $response->_headersRaw;
|
||||||
|
$this->_httpResponseCode = $response->_httpResponseCode;
|
||||||
|
$this->headersSentThrowsException = $response->headersSentThrowsException;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user