Skip to content

Commit

Permalink
refactor(Response): improve request and response summary handling
Browse files Browse the repository at this point in the history
- Added handling for request and response summaries
- Removed unnecessary code related to headers, status, reason, and body
  • Loading branch information
guanguans committed Mar 22, 2024
1 parent 6039001 commit 9593081
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/Foundation/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use Guanguans\Notify\Foundation\Exceptions\RuntimeException;
use Guanguans\Notify\Foundation\Support\Arr;
use GuzzleHttp\Cookie\CookieJar;
use GuzzleHttp\Psr7\Message;
use GuzzleHttp\TransferStats;
use Illuminate\Support\Collection;
use Psr\Http\Message\RequestInterface;
Expand Down Expand Up @@ -74,13 +75,15 @@ public function __debugInfo(): array
{
return $this->mergeDebugInfo([
'handlerStats' => $this->handlerStats(),
'headers' => Arr::map(
$this->headers(),
fn (array $header, string $name): string => $this->getHeaderLine($name),
),
'status' => $this->status(),
'reason' => $this->reason(),
'body' => $this->body(),
'requestSummary' => $this->request instanceof RequestInterface ? Message::toString($this->request) : null,
'responseSummary' => Message::toString($this),
// 'headers' => Arr::map(
// $this->headers(),
// fn (array $header, string $name): string => $this->getHeaderLine($name),
// ),
// 'status' => $this->status(),
// 'reason' => $this->reason(),
// 'body' => $this->body(),
'decodedBody' => $this->json(),
]);
}
Expand Down

0 comments on commit 9593081

Please sign in to comment.