Skip to content
This repository has been archived by the owner on Nov 12, 2022. It is now read-only.

Commit

Permalink
4xx errors in the "I request ..." step do not throw exceptions anymor…
Browse files Browse the repository at this point in the history
…e. The response just gets stored in the response object.
  • Loading branch information
Johan de Jager authored and Johan de Jager committed Oct 18, 2016
1 parent eeb29b8 commit 3cdde1f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
vendor/
.idea/
composer.lock
composer.lock
12 changes: 9 additions & 3 deletions features/bootstrap/ApiFeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
class ApiFeatureContext implements Context
{

/**
* Payload of the request
*
Expand Down Expand Up @@ -142,8 +143,13 @@ public function iRequest($httpMethod, $resource)
$options = ['auth' => [$this->authUser, $this->authPassword]];
}

// Send request
$this->response = $this->client->send($this->lastRequest, $options);
try {
// Send request
$this->response = $this->client->send($this->lastRequest, $options);

} catch (\GuzzleHttp\Exception\ClientException $e) { // Client exceptions (4xx status codes) are OK
$this->response = $e->getResponse();
}
}


Expand Down Expand Up @@ -721,4 +727,4 @@ public function theEmbeddedShouldHaveAPropertyEqualTo($embeddedName, $property,
$value
);
}
}
}

0 comments on commit 3cdde1f

Please sign in to comment.