Skip to content

Commit 4fb1655

Browse files
author
Marnier Vivien
committed
post request fix
1 parent 0c7f367 commit 4fb1655

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

src/Service/ModeloClient.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function createContract(string $modelName, bool $isDocType = false, strin
7979
throw new ModelNotFound($type.' was not found with specific '.$modelName.' name.');
8080
}
8181

82-
return $this->createContractByModelId($modelId, $outputPdf, $xml);
82+
return $this->createContractByModelId($modelId, null, $outputPdf, $xml);
8383
}
8484

8585
/**
@@ -264,14 +264,17 @@ public function createContractByModelId(string $modelId, string $contractId = nu
264264

265265

266266
$response = $this->client->request('POST', $uri, [
267-
'query' => array_merge($this->getGenericParams(), [
267+
'headers' => [
268+
'Content-Type: application/xml',
269+
'Accept: application/xml',
270+
],
271+
'query' => [
272+
self::AUTHKEY_PARAM_KEY => $this->getAuthKey(),
268273
$keyName => $modelId,
269274
self::OUTPUT_PARAM_KEY => $outputValue,
270275
self::CONTRACT_ID_KEY => $contractId,
271-
]),
272-
'body' => [
273-
'xml' => $xml,
274276
],
277+
'body' => $xml,
275278
]);
276279

277280
if (Response::HTTP_OK !== $response->getStatusCode()) {
@@ -302,13 +305,16 @@ public function updateContractById(string $contractId, string $xml = null, bool
302305
$outputValue = $outputPdf ? 'pdf' : null;
303306

304307
$response = $this->client->request('PUT', self::CONTRACT_URI, [
305-
'query' => array_merge($this->getGenericParams(), [
306-
'_id' => $contractId,
308+
'headers' => [
309+
'Content-Type: application/xml',
310+
'Accept: application/xml',
311+
],
312+
'query' => [
313+
self::AUTHKEY_PARAM_KEY => $this->getAuthKey(),
307314
self::OUTPUT_PARAM_KEY => $outputValue,
308-
]),
309-
'body' => [
310-
'xml' => $xml,
315+
self::CONTRACT_ID_KEY => $contractId,
311316
],
317+
'body' => $xml,
312318
]);
313319

314320
if (Response::HTTP_OK !== $response->getStatusCode()) {

0 commit comments

Comments
 (0)