Commit d5658b63 authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix: add Prefer:return=representation to Supabase REST calls for INSERT/PATCH

Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 488a5d70
......@@ -70,7 +70,8 @@ switch ($action) {
'starting_fen' => 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1',
'current_fen' => 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1',
'move_count' => 0,
'moves' => '[]',
'moves' => json_encode([]),
'game_state' => json_encode([]),
'started_at' => date('c'),
];
......
......@@ -27,6 +27,10 @@ function supabase_rest(string $method, string $endpoint, array $data = [], ?stri
$data = [];
}
if ($method === 'POST' || $method === 'PATCH') {
$headers[] = 'Prefer: return=representation';
}
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment