class ClientRequestWatcher extends Watcher

Constants

private MIDDLEWARE_NAME

protected DEFAULT_REQUEST_SIZE_LIMIT

Methods

__construct(array $options = [])

Create a new watcher instance.

from  Watcher
void
register(Application $app)

Register the watcher.

setOptions(array $options)

Set the watcher options.

from  Watcher
array
hideParameters(array $data, array $hidden)

Hide the given parameters.

from  Watcher
string
hideQueryParameters(string $uri)

Hide query credentials without changing unrelated URL bytes.

from  Watcher
callable
recordRequests(callable $handler)

Record each completed Guzzle request.

void
recordTransfer(RequestInterface $request, TransferStats|null $stats, ResponseInterface|null $response, array $options, array $customTags)

Record a settled transfer.

bool
shouldIgnoreHost(string $host)

Determine whether to ignore this request based on its host.

array|string
buildPayload(RequestInterface $request, array $options)

Build the request payload, using structured Hypervel data when available.

array|string
structuredPayload(RequestInterface $request, array $data)

Format the structured payload from Hypervel's HTTP client.

array
formatMultipartData(array $data)

Format multipart data for display.

array|string
payload(array $payload)

Format the structured payload with size limit and parameter hiding.

array|string
formatStructuredPayload(array $payload, array $hidden, int $sizeLimit)

Format a structured payload for entry storage.

array|string
getRequestPayload(RequestInterface $request)

Extract the payload from the raw PSR-7 request body.

array
getResponse(ResponseInterface $response)

Extract response data from the PSR-7 response.

array|string
getResponsePayload(ResponseInterface $response)

Extract the payload from the PSR-7 response body.

array
headers(array $headers)

Format the given headers.

static void
flushState()

Flush all static state.

Details

in Watcher at line 18
__construct(array $options = [])

Create a new watcher instance.

Parameters

array $options

the configured watcher options

at line 40
void register(Application $app)

Register the watcher.

The middleware persists for the worker lifetime and affects every Guzzle client.

Parameters

Application $app

Return Value

void

in Watcher at line 31
Watcher setOptions(array $options)

Set the watcher options.

Parameters

array $options

Return Value

Watcher

in Watcher at line 41
protected array hideParameters(array $data, array $hidden)

Hide the given parameters.

Parameters

array $data
array $hidden

Return Value

array

in Watcher at line 55
protected string hideQueryParameters(string $uri)

Hide query credentials without changing unrelated URL bytes.

Parameters

string $uri

Return Value

string

at line 49
protected callable recordRequests(callable $handler)

Record each completed Guzzle request.

Parameters

callable $handler

Return Value

callable

at line 97
protected void recordTransfer(RequestInterface $request, TransferStats|null $stats, ResponseInterface|null $response, array $options, array $customTags)

Record a settled transfer.

The last transfer stats hold the prepared request of the final redirect, including the request options and middleware changes; the entry request is used when there are none.

Parameters

RequestInterface $request
TransferStats|null $stats
ResponseInterface|null $response
array $options
array $customTags

Return Value

void

at line 124
protected bool shouldIgnoreHost(string $host)

Determine whether to ignore this request based on its host.

Parameters

string $host

Return Value

bool

at line 139
protected array|string buildPayload(RequestInterface $request, array $options)

Build the request payload, using structured Hypervel data when available.

When the request originated from Hypervel's HTTP client, the caller's structured payload is available in the hypervel_data Guzzle option. Body replacements made later by before-sending callbacks do not rewrite those original options, so this describes caller intent and may differ from bytes replaced later in the handler stack. Raw and third-party traffic is parsed from the PSR-7 body instead.

Parameters

RequestInterface $request
array $options

Return Value

array|string

at line 151
protected array|string structuredPayload(RequestInterface $request, array $data)

Format the structured payload from Hypervel's HTTP client.

Parameters

RequestInterface $request
array $data

Return Value

array|string

at line 168
protected array formatMultipartData(array $data)

Format multipart data for display.

Parameters

array $data

Return Value

array

at line 203
protected array|string payload(array $payload)

Format the structured payload with size limit and parameter hiding.

Parameters

array $payload

Return Value

array|string

at line 215
protected array|string formatStructuredPayload(array $payload, array $hidden, int $sizeLimit)

Format a structured payload for entry storage.

Parameters

array $payload
array $hidden
int $sizeLimit

Return Value

array|string

at line 239
protected array|string getRequestPayload(RequestInterface $request)

Extract the payload from the raw PSR-7 request body.

Parameters

RequestInterface $request

Return Value

array|string

at line 313
protected array getResponse(ResponseInterface $response)

Extract response data from the PSR-7 response.

Parameters

ResponseInterface $response

Return Value

array

at line 325
protected array|string getResponsePayload(ResponseInterface $response)

Extract the payload from the PSR-7 response body.

Parameters

ResponseInterface $response

Return Value

array|string

at line 396
protected array headers(array $headers)

Format the given headers.

Parameters

array $headers

Return Value

array

at line 425
static void flushState()

Flush all static state.

Return Value

void