Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Allow non-200 connections when waiting for server for tests. #1798

Merged
merged 1 commit into from
Jul 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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