I am working on GitLab API to commit an mp3 file and it was working for years without having problems and the last few weeks it is throwing errors
GuzzleHttp\Exception\ClientException: Client error: `POST https://gitlab.com/api/v4/projects/.../repository/commits/` resulted in a `400 Bad Request` response in file vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 113
Here is the code I am using,
$client = new Client([
// Base URI is used with relative requests
'base_uri' => 'https://gitlab.com/',
// You can set any number of default request options.
'timeout' => 300,
]);
$files = [
[
'name' => 'branch',
'contents' => 'TEST'
],
[
'name' => 'commit_message',
'contents' => 'Some message'
],
[
'name' => 'actions[][action]',
'contents' => 'update'
],
[
'name' => 'actions[][file_path]',
'contents' => 'gitlab filepath/test.mp3'
],
[
'name' => 'actions[][content]',
'contents' => file_get_contents('localfilepath/test.mp3')
],
];
$response = $client->request('POST', '/api/v4/projects/.../repository/commits/', [
'headers' => [
'PRIVATE-TOKEN' => $TOKEN
],
'multipart' => $files
]);
return $response->getBody()->getContents();
```
Thanks in Advance