Skip to content

Commit 747518c

Browse files
Fix issue with correct content type
Signed-off-by: Oleksandr Mykhailenko <[email protected]>
1 parent 7c285a5 commit 747518c

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/Mailjet/Client.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,13 @@ private function _call(string $method, string $resource, string $action, array $
298298

299299
$url = $this->buildURL($resource, $action, (string) $args['id'], $args['actionid']);
300300

301-
$contentType = ('csvdata/text:plain' === $action || 'csverror/text:csv' === $action) ? 'text/plain' : 'application/json';
302-
301+
$contentType = 'application/json';
302+
if ('csvdata/text:plain' === $action) {
303+
$contentType = 'text/plain';
304+
} else if ('csverror/text:csv' === $action) {
305+
$contentType = 'text/csv';
306+
}
307+
303308
$isBasicAuth = $this->isBasicAuthentication($this->apikey, $this->apisecret);
304309
$auth = $isBasicAuth ? [$this->apikey, $this->apisecret] : [$this->apitoken];
305310

src/Mailjet/Request.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,7 @@ public function call($call)
138138

139139
if ($call) {
140140
try {
141-
$response = \call_user_func_array(
142-
[$this, strtolower($this->method)],
143-
[$this->url, $payload]
144-
);
141+
$response = call_user_func([$this, strtolower($this->method)], $this->url, $payload);
145142
} catch (ClientException $e) {
146143
$response = $e->getResponse();
147144
} catch (ServerException $e) {

0 commit comments

Comments
 (0)