Skip to content

Commit 867b11a

Browse files
authored
Merge pull request #37 from Local-Data-Exchange/json_map_if_body_exist
#1183834945962833 Return empty array if body is not given.
2 parents fad5e20 + b774e3b commit 867b11a

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
# CHANGELOG
2+
## 0.1.28
3+
- Perform json mapping if body is given.
4+
5+
## 0.1.27
6+
- Bug fix of xml boolean assign.
7+
8+
## 0.1.26
9+
- Adding support of boolean in query param.
10+
11+
## 0.1.25
12+
- Add support of optional query param.
13+
214
## 0.1.24
315
- Adding logs in json mapping, so we can figure out if something is wrong with data.
416

src/ApiBuilder.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,9 @@ protected function processQueryMappings($arguments, $api, $uri): string
479479
protected function processJsonMappings($arguments, $api): array
480480
{
481481
$json = json_encode(array_get($api, 'body', []));
482+
if (empty($json)) {
483+
return [];
484+
}
482485
foreach (array_get($api, 'mappings.body', []) as $key => $value) {
483486

484487
//Remove array key which is nullable, Need to specify "nullable" in api_helper.php config file.

0 commit comments

Comments
 (0)