Skip to content

Commit

Permalink
Remove 0 as request data
Browse files Browse the repository at this point in the history
  • Loading branch information
franmomu committed May 24, 2022
1 parent 81be73f commit 0b739c7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Updated `symfony/phpunit-bridge` to `6.0` by @franmomu [#2067](https://github.com/ruflin/Elastica/pull/2067)
### Deprecated
### Removed
* Removed `0` as valid request data using Analyze API by @franmomu [#2068](https://github.com/ruflin/Elastica/pull/2068)
### Fixed
### Security

Expand Down
2 changes: 1 addition & 1 deletion src/Transport/Guzzle.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected function _createPsr7Request(Request $request, Connection $connection)
);

$data = $request->getData();
if (!empty($data) || '0' === $data) {
if (!empty($data)) {
if (Request::GET === $req->getMethod()) {
$req = $req->withMethod(Request::POST);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Transport/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function exec(Request $request, array $params): Response

$headers[] = 'Content-Type: '.$request->getContentType();

if (!empty($data) || '0' === $data) {
if (!empty($data)) {
if ($this->hasParam('postWithRequestBody') && true == $this->getParam('postWithRequestBody')) {
$httpMethod = Request::POST;
}
Expand Down

0 comments on commit 0b739c7

Please sign in to comment.