Add browser XHR forwarding

This commit is contained in:
2026-08-05 16:19:43 +02:00
parent f2757c9b1c
commit 06f99b0c17
5 changed files with 701 additions and 1 deletions
+35
View File
@@ -75,6 +75,16 @@ class Inspector extends Component
{
if (($event['endpointId'] ?? null) === $this->endpointId) {
$this->resetPage();
$requestId = $event['requestId'] ?? null;
if (is_string($requestId) && $requestId !== '') {
$this->dispatch(
'xhr-request-available',
endpointId: $this->endpointId,
requestId: $requestId,
);
}
}
}
@@ -100,6 +110,31 @@ class Inspector extends Component
$this->selectedRequestId = null;
}
/**
* @return array{
* endpointId: string,
* requestId: string,
* method: string,
* requestUri: string,
* headers: array<string, array<int, string>|string>,
* body: string,
* }
*/
public function xhrRequestPayload(string $requestId): array
{
$webhookRequest = $this->endpoint()->requests()->findOrFail($requestId);
Gate::authorize('view', $webhookRequest);
return [
'endpointId' => (string) $this->endpointId,
'requestId' => (string) $webhookRequest->getKey(),
'method' => $webhookRequest->method,
'requestUri' => $webhookRequest->request_uri,
'headers' => $webhookRequest->headers ?? [],
'body' => base64_encode((string) ($webhookRequest->body ?? '')),
];
}
public function deleteRequest(string $requestId, DeleteWebhookRequestAction $deleteWebhookRequest): void
{
$webhookRequest = $this->endpoint()->requests()->findOrFail($requestId);