Skip to content

Commit

Permalink
Allow non-200 connections when waiting for server for tests. (#1798)
Browse files Browse the repository at this point in the history
  • Loading branch information
danepowell authored and grasmash committed Jul 13, 2017
1 parent 4362ec0 commit 5036a77
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Robo/Common/Executor.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function killProcessByName($name) {
}

/**
* Waits until a given URL responds with a 200.
* Waits until a given URL responds with a non-50x response.
*
* This does have a maximum timeout, defined in wait().
*
Expand Down Expand Up @@ -194,13 +194,13 @@ public function wait(callable $callable, array $args, $message = '') {
}

/**
* Checks a URL for a 200 response.
* Checks a URL for a non-50x response.
*
* @param string $url
* The URL to check.
*
* @return bool
* TRUE if URL responded with a 200.
* TRUE if URL responded with a non-50x response.
*/
public function checkUrl($url) {
try {
Expand All @@ -210,7 +210,12 @@ public function checkUrl($url) {
'timeout' => 2,
'exceptions' => FALSE,
]);
return $res->getStatusCode() == 200;
if ($res->getStatusCode() && substr($res->getStatusCode(), 0, 1) != '5') {
return TRUE;
}
else {
return FALSE;
}
}
catch (\Exception $e) {

Expand Down

0 comments on commit 5036a77

Please sign in to comment.