Skip to content

Commit

Permalink
Merge pull request #37 from Local-Data-Exchange/json_map_if_body_exist
Browse files Browse the repository at this point in the history
#1183834945962833 Return empty array if body is not given.
  • Loading branch information
munir131 authored Jul 9, 2020
2 parents fad5e20 + b774e3b commit 867b11a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
# CHANGELOG
## 0.1.28
- Perform json mapping if body is given.

## 0.1.27
- Bug fix of xml boolean assign.

## 0.1.26
- Adding support of boolean in query param.

## 0.1.25
- Add support of optional query param.

## 0.1.24
- Adding logs in json mapping, so we can figure out if something is wrong with data.

Expand Down
3 changes: 3 additions & 0 deletions src/ApiBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,9 @@ protected function processQueryMappings($arguments, $api, $uri): string
protected function processJsonMappings($arguments, $api): array
{
$json = json_encode(array_get($api, 'body', []));
if (empty($json)) {
return [];
}
foreach (array_get($api, 'mappings.body', []) as $key => $value) {

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

0 comments on commit 867b11a

Please sign in to comment.