Skip to content

Commit

Permalink
Merge pull request #6 from zepgram/develop
Browse files Browse the repository at this point in the history
[v2.0.1] add support for application/x-www-form-urlencoded
  • Loading branch information
zepgram authored May 3, 2024
2 parents 85fed91 + b0d0e5b commit 8212c4b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Service/ApiBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 8212c4b

Please sign in to comment.