From 8ca5c1fd8c2f893881d74cbbdd8a53538f7ad7ae Mon Sep 17 00:00:00 2001 From: Adeildo Amorim Date: Mon, 25 Mar 2024 19:35:20 -0300 Subject: [PATCH] [Refactor] Added content type multipart/form-data in headers if file or attachment is provided --- src/Common/CelcoinBaseApi.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Common/CelcoinBaseApi.php b/src/Common/CelcoinBaseApi.php index 4fceba5..1ceaad5 100644 --- a/src/Common/CelcoinBaseApi.php +++ b/src/Common/CelcoinBaseApi.php @@ -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'); } } @@ -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)