Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion config/telescope.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@
'ignore' => [],
],

Watchers\ClientRequestWatcher::class => env('TELESCOPE_CLIENT_REQUEST_WATCHER', true),
Watchers\ClientRequestWatcher::class => [
'enabled' => env('TELESCOPE_CLIENT_REQUEST_WATCHER', true),
'ignore_hosts' => [],
],

Watchers\CommandWatcher::class => [
'enabled' => env('TELESCOPE_COMMAND_WATCHER', true),
Expand Down
16 changes: 15 additions & 1 deletion src/Watchers/ClientRequestWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public function recordFailedRequest(ConnectionFailed $event)
*/
public function recordResponse(ResponseReceived $event)
{
if (! Telescope::isRecording()) {
if (! Telescope::isRecording() ||
$this->shouldIgnoreHost($event)) {
return;
}

Expand All @@ -76,6 +77,19 @@ public function recordResponse(ResponseReceived $event)
);
}

/**
* Determine whether to ignore this request based on its host.
*
* @param mixed $event
* @return bool
*/
protected function shouldIgnoreHost($event)
{
$host = $event->request->toPsrRequest()->getUri()->getHost();

return in_array($host, Arr::get($this->options, 'ignore_hosts', []));
}

/**
* Determine if the content is within the set limits.
*
Expand Down