diff --git a/Service/ApiBuilder.php b/Service/ApiBuilder.php index 2af0c7a..75c24ce 100644 --- a/Service/ApiBuilder.php +++ b/Service/ApiBuilder.php @@ -136,6 +136,10 @@ private function getOptions(ApiProviderInterface $apiProvider, RequestAdapter $r } else { $options['body'] = $apiProvider->isJsonRequest() ? $this->serializer->serialize($body) : $body; } + $contentType = $requestAdapter->getHeaders()['Content-Type'] ?? null; + if ($contentType === 'application/x-www-form-urlencoded') { + $options['form_params'] = $body; + } $options['headers'] = $requestAdapter->getHeaders(); $options['verify'] = $apiProvider->isVerify(); $options['http_errors'] = true; diff --git a/composer.json b/composer.json index aa27ae8..009ec4f 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "zepgram/module-rest", "description": "Technical module to industrialize API REST call with dependency injection pattern using Guzzle library", "type": "magento2-module", - "version": "2.0.0", + "version": "2.0.1", "authors": [ { "name": "Benjamin Calef",