Skip to content

Commit

Permalink
Add support for skipping response parsing for operations with no defi…
Browse files Browse the repository at this point in the history
…ned response
  • Loading branch information
jeskew committed Jan 19, 2016
1 parent 0ca3101 commit 66db060
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Api/Parser/AbstractRestParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ public function __invoke(
}
}

if (!$payload && $response->getBody()->getSize() > 0) {
if (!$payload
&& $response->getBody()->getSize() > 0
&& count($output->getMembers()) > 0
) {
// if no payload was found, then parse the contents of the body
$this->payload($response, $output, $result);
}
Expand Down
20 changes: 20 additions & 0 deletions tests/Api/test_cases/protocols/output/rest-json.json
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,26 @@
}
]
},
{
"description": "Ignores undefined output",
"metadata": {
"protocol": "rest-json"
},
"shapes": {},
"cases": [
{
"given": {
"name": "OperationName"
},
"result": {},
"response": {
"status_code": 200,
"headers": {},
"body": "OK"
}
}
]
},
{
"description": "Supports header maps",
"metadata": {
Expand Down

0 comments on commit 66db060

Please sign in to comment.