diff --git a/routes/api.php b/routes/api.php index 201cbd5..6799a28 100644 --- a/routes/api.php +++ b/routes/api.php @@ -26,7 +26,7 @@ Route::post('api/event', function (Request $request) { } $headers = collect($request->headers->all()) - ->mapWithKeys(fn($value, $key) => [$key => is_array($value) ? implode(', ', $value) : $value]) + ->mapWithKeys(fn ($value, $key) => [$key => is_array($value) ? implode(', ', $value) : $value]) ->all(); Http::withHeaders($headers)->post(config('plausible-proxy.domain').'/api/event', $data); diff --git a/tests/PlausibleProxyTest.php b/tests/PlausibleProxyTest.php index a6c94f5..157d4cc 100644 --- a/tests/PlausibleProxyTest.php +++ b/tests/PlausibleProxyTest.php @@ -56,11 +56,11 @@ it('accepts valid event data and forwards headers', function () { 'https://plausible.io/api/event' => function ($request) { dump($request->headers()); dump($request->data()); + return Http::response(['status' => 'queued'], 200); }, ]); - $headers = [ 'User-Agent' => 'TestAgent', 'Accept' => 'application/json', @@ -88,5 +88,3 @@ it('accepts valid event data and forwards headers', function () { && isset($request['d']) && $request['d'] === 'example.com'; }); }); - -