Skip to content

Commit

Permalink
Merge pull request #61 from wedevBr/feature/MultipartFormData
Browse files Browse the repository at this point in the history
[Refactor] Added content type multipart/form-data in headers if file …
  • Loading branch information
adeildo-jr authored Mar 25, 2024
2 parents ed1f7e1 + 8ca5c1f commit 1d2a28b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Common/CelcoinBaseApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public function post(string $endpoint, array $body = [], Attachable $attachment
foreach ($body as $field => $document) {
if ($document instanceof File) {
$request->attach($field, $document->getContent(), $document->getFileName());
$request->contentType('multipart/form-data');
}
}

Expand All @@ -117,6 +118,7 @@ public function post(string $endpoint, array $body = [], Attachable $attachment
$attachment->getFileName(),
$attachment->getHeaders()
);
$request->contentType('multipart/form-data');
}

return $request->post($this->getFinalUrl($endpoint), $body)
Expand Down

0 comments on commit 1d2a28b

Please sign in to comment.