From 612d7849cf0e782305e167ac726228d9c5dc7bda Mon Sep 17 00:00:00 2001 From: Thibault GRANADA Date: Fri, 18 Mar 2022 14:19:17 +0100 Subject: [PATCH 1/2] Fix debugbar decorator not returning headers --- .../BarryvdhLaravelDebugbar/DebugbarTransportDecorator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bridges/BarryvdhLaravelDebugbar/DebugbarTransportDecorator.php b/src/Bridges/BarryvdhLaravelDebugbar/DebugbarTransportDecorator.php index dfe99aa..e661a67 100644 --- a/src/Bridges/BarryvdhLaravelDebugbar/DebugbarTransportDecorator.php +++ b/src/Bridges/BarryvdhLaravelDebugbar/DebugbarTransportDecorator.php @@ -188,6 +188,6 @@ public static function formatDuration($seconds) public function getResponseHeaders(): array { - $this->transport->getResponseHeaders(); + return $this->transport->getResponseHeaders(); } } From a5f29b0fda5982f973a0d4f5d050fb07d84ce97c Mon Sep 17 00:00:00 2001 From: Thibault GRANADA Date: Fri, 18 Mar 2022 14:19:33 +0100 Subject: [PATCH 2/2] Add exception API source --- src/Exceptions/ApiException.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Exceptions/ApiException.php b/src/Exceptions/ApiException.php index 4ecf49e..cff9f92 100755 --- a/src/Exceptions/ApiException.php +++ b/src/Exceptions/ApiException.php @@ -9,6 +9,11 @@ class ApiException extends Exception { protected $response; + /** + * @var string|null Can be used to specify from which API the exception has been thrown. + */ + protected $source; + public function __construct($response, $message = "", $httpCode = 0, Throwable $previous = null) { parent::__construct("The request ended on a $httpCode code : $message", $httpCode, $previous); @@ -38,4 +43,16 @@ public function getApiErrors() { return $this->getResponse('errors'); } + + public function getSource(): ?string + { + return $this->source; + } + + public function setSource(?string $source): self + { + $this->source = $source; + + return $this; + } }