Skip to content

Commit

Permalink
Fix: retrieving body of http calls results
Browse files Browse the repository at this point in the history
  • Loading branch information
gggeek committed May 24, 2017
1 parent e149412 commit ae07923
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion Core/Executor/HTTPExecutor.php
Expand Up @@ -81,6 +81,12 @@ protected function call($dsl, $context)
return $response;
}

/**
* @param ResponseInterface $response
* @param array $dsl
* @return bool
* @todo use jmespath syntax to allow setting refs to response headers
*/
protected function setReferences(ResponseInterface $response, $dsl)
{
if (!array_key_exists('references', $dsl)) {
Expand All @@ -99,7 +105,10 @@ protected function setReferences(ResponseInterface $response, $dsl)
$value = $response->getProtocolVersion();
break;
case 'body':
$value = $response->getBody();
$value = $response->getBody()->__toString();
break;
case 'body_size':
$value = $response->getBody()->getSize();
break;
default:
throw new \InvalidArgumentException('HTTP executor does not support setting references for attribute ' . $reference['attribute']);
Expand Down
2 changes: 1 addition & 1 deletion Resources/doc/DSL/HTTP.yml
Expand Up @@ -20,7 +20,7 @@
-
identifier: referenceId # A string used to identify the reference
attribute: attributeId # An attribute to get the value of for the reference.
# Supports: status_code, reason_phrase, protocol_version, body
# Supports: status_code, reason_phrase, protocol_version, body, body_size

# *** Setting it up: ***
#
Expand Down

0 comments on commit ae07923

Please sign in to comment.