Forward JSON registration POST bodies through the ladl.link proxy.
Deploy Ladill Link / deploy (push) Successful in 41s
Deploy Ladill Link / deploy (push) Successful in 41s
Event signup from ladl.link sends application/json; re-encoding as form data dropped the payload and caused failed registrations to redirect to ladl.link/undefined. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -74,7 +74,7 @@ class LinkPlatformProxy
|
||||
->withHeaders($this->forwardHeaders($request));
|
||||
|
||||
$pending = match ($method) {
|
||||
'POST' => $client->asForm()->post($target, $request->post()),
|
||||
'POST' => $this->forwardPost($client, $request, $target),
|
||||
'PATCH' => $client->patch($target, $request->all()),
|
||||
'DELETE' => $client->delete($target),
|
||||
default => $client->get($target),
|
||||
@@ -143,12 +143,27 @@ class LinkPlatformProxy
|
||||
return array_filter([
|
||||
'Accept' => $request->header('Accept'),
|
||||
'Accept-Language' => $request->header('Accept-Language'),
|
||||
'Content-Type' => $request->header('Content-Type'),
|
||||
'User-Agent' => $request->header('User-Agent'),
|
||||
'Referer' => $request->header('Referer'),
|
||||
self::INTERNAL_HEADER => '1',
|
||||
]);
|
||||
}
|
||||
|
||||
private function forwardPost(\Illuminate\Http\Client\PendingRequest $client, Request $request, string $target): \Illuminate\Http\Client\Response
|
||||
{
|
||||
if ($this->requestSendsJson($request)) {
|
||||
return $client->asJson()->post($target, $request->all());
|
||||
}
|
||||
|
||||
return $client->asForm()->post($target, $request->post());
|
||||
}
|
||||
|
||||
private function requestSendsJson(Request $request): bool
|
||||
{
|
||||
return str_contains(strtolower((string) $request->header('Content-Type', '')), 'application/json');
|
||||
}
|
||||
|
||||
/** @param array<string, array<int, string>> $headers */
|
||||
private function sanitizeHeaders(array $headers): array
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user