Skip to content

Commit

Permalink
Merge pull request #22 from teaandcode/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
knasher authored Jun 14, 2017
2 parents baf10b3 + ad974d2 commit 8b554cc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: php

php:
- 5.3
- 5.4
- 5.5
- 5.6
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"php": ">=5.3.3",
"behat/behat": "~3.0,>=3.0.5",
"guzzle/guzzle": ">=3.5",
"symfony/config": ">=2.2"
"symfony/config": ">=2.2 <3.3"
},
"require-dev": {
"phpspec/phpspec": "~2.0",
Expand Down
21 changes: 19 additions & 2 deletions src/Behat/GuzzleExtension/Context/RawGuzzleContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Behat\GuzzleExtension\Context;

use Guzzle\Common\Exception\RuntimeException;
use Guzzle\Http\Exception\BadResponseException;
use Guzzle\Http\Exception\ClientErrorResponseException;
use Guzzle\Http\Message\Response;
Expand All @@ -38,7 +39,7 @@ class RawGuzzleContext implements GuzzleAwareContext
/**
* @var string
*/
const GUZZLE_EXTENSION_VERSION = '0.4.0';
const GUZZLE_EXTENSION_VERSION = '0.4.1';

/**
* @var Client
Expand Down Expand Up @@ -90,6 +91,22 @@ public function executeCommand($command, array $data = array())
} catch (BadResponseException $e) {
$this->response = $e->getResponse();

try {
$this->result = $this->response->json();

return;
} catch (RuntimeException $e) {
continue;
}

try {
$this->result = $this->response->xml();

return;
} catch (RuntimeException $e) {
continue;
}

return;
}

Expand Down Expand Up @@ -325,7 +342,7 @@ private function setRequestOptions(array $options)
* Adds, updates or removes header (if no value is provided)
*
* @param string $field Field name
* @param mixed $value Header value
* @param string $value Header value
*
* @access private
* @return void
Expand Down

0 comments on commit 8b554cc

Please sign in to comment.