Skip to content

Commit fd071b9

Browse files
committed
Client: add content type header
1 parent 628c35d commit fd071b9

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/Api/AbstractApi.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ protected function get($path, array $parameters = [], array $headers = [])
3131
}
3232
$response = $this->client->getHttpClient()->get(
3333
$path,
34-
array_merge($headers, ['Accept' => 'application/json'])
34+
array_merge($headers, [
35+
'Accept' => 'application/json',
36+
'Content-Type' => 'application/json',
37+
])
3538
);
3639

3740
return $this->responseMediator->getContent($response);
@@ -47,7 +50,10 @@ protected function post($path, array $parameters = [], array $headers = [])
4750
{
4851
$response = $this->client->getHttpClient()->post(
4952
$path,
50-
array_merge($headers, ['Accept' => 'application/json']),
53+
array_merge($headers, [
54+
'Accept' => 'application/json',
55+
'Content-Type' => 'application/json',
56+
]),
5157
$this->createJsonBody($parameters)
5258
);
5359

@@ -64,7 +70,10 @@ protected function delete($path, array $parameters = [], array $headers = [])
6470
{
6571
$response = $this->client->getHttpClient()->delete(
6672
$path,
67-
array_merge($headers, ['Accept' => 'application/json']),
73+
array_merge($headers, [
74+
'Accept' => 'application/json',
75+
'Content-Type' => 'application/json',
76+
]),
6877
$this->createJsonBody($parameters)
6978
);
7079

0 commit comments

Comments
 (0)