Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
huzaifaarain authored and github-actions[bot] committed May 3, 2023
1 parent 25d9c2b commit ad2986b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
8 changes: 4 additions & 4 deletions config/telescope-guzzle-watcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
|
*/

"except_request_headers" => [],
'except_request_headers' => [],

/*
|--------------------------------------------------------------------------
Expand All @@ -27,7 +27,7 @@
|
*/

"except_response_headers" => [],
'except_response_headers' => [],

/*
|--------------------------------------------------------------------------
Expand All @@ -40,7 +40,7 @@
|
*/

"enable_uri_tags" => true,
'enable_uri_tags' => true,

/*
|--------------------------------------------------------------------------
Expand All @@ -52,5 +52,5 @@
|
*/

"exclude_words_from_uri_tags" => [],
'exclude_words_from_uri_tags' => [],
];
1 change: 0 additions & 1 deletion src/TelescopeGuzzleWatcherServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;
use MuhammadHuzaifa\TelescopeGuzzleWatcher\Commands\TelescopeGuzzleWatcherCommand;

class TelescopeGuzzleWatcherServiceProvider extends PackageServiceProvider
{
Expand Down
15 changes: 7 additions & 8 deletions src/Watchers/TelescopeGuzzleWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

class TelescopeGuzzleWatcher extends Watcher
{

public function register($app)
{
$app->bind(
Expand Down Expand Up @@ -48,19 +47,19 @@ private static function makeEntry(TransferStats $stats): IncomingEntry
{
$stats->getResponse()?->getBody()->rewind();
$stats->getRequest()?->getBody()->rewind();
$requestBody = json_decode($stats->getRequest()?->getBody()->getContents() ?? "", true);
$requestBody = json_decode($stats->getRequest()?->getBody()->getContents() ?? '', true);
$queryString = null;
parse_str($stats->getRequest()?->getUri()->getQuery(), $queryString);
$payload = array_merge(["queryString" => $queryString ?? []], ["body" => $requestBody ?? []]);
$payload = array_merge(['queryString' => $queryString ?? []], ['body' => $requestBody ?? []]);

$entry = IncomingEntry::make([
'method' => $stats->getRequest()->getMethod(),
'uri' => strtok($stats->getRequest()->getUri(), "?"),
'uri' => strtok($stats->getRequest()->getUri(), '?'),
'headers' => Arr::except($stats->getRequest()->getHeaders(), config('telescope-guzzle-watcher.except_request_headers', [])),
'payload' => $payload,
'response_status' => $stats->getResponse()->getStatusCode(),
'response_headers' => Arr::except($stats->getResponse()->getHeaders(), config('telescope-guzzle-watcher.except_request_headers', [])),
'response' => json_decode($stats->getResponse()->getBody()->getContents(), true)
'response' => json_decode($stats->getResponse()->getBody()->getContents(), true),
]);

if (Auth::check()) {
Expand All @@ -78,15 +77,15 @@ private static function extractTagsFromUri(string $uri)
{
$parsedURI = parse_url($uri);
$tags = [$parsedURI['host']];
if (array_key_exists("path", $parsedURI)) {
$pathArr = array_filter(explode("/", $parsedURI['path']));
if (array_key_exists('path', $parsedURI)) {
$pathArr = array_filter(explode('/', $parsedURI['path']));
$tags = array_merge($tags, $pathArr);
}

$exceptTags = config('telescope-guzzle-watcher.exclude_words_from_uri_tags');
if (count($exceptTags) > 0) {
$tags = Arr::where($tags, function ($tag) use ($exceptTags) {
return !in_array($tag, $exceptTags);
return ! in_array($tag, $exceptTags);
});
}

Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace MuhammadHuzaifa\TelescopeGuzzleWatcher\Tests;

use Illuminate\Database\Eloquent\Factories\Factory;
use Orchestra\Testbench\TestCase as Orchestra;
use MuhammadHuzaifa\TelescopeGuzzleWatcher\TelescopeGuzzleWatcherServiceProvider;
use Orchestra\Testbench\TestCase as Orchestra;

class TestCase extends Orchestra
{
Expand Down

0 comments on commit ad2986b

Please sign in to comment.