1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Acccept any HTTP 2xx status as success in Harbormaster

Summary: Ref T9478. This should probably be configurable eventually, but for now treat any 200-block status as success. Also show the result code.

Test Plan:
  - Hit a bad URI, saw "HTTP 503" + failure.
  - Hit a good URI, saw "HTTP 200" + success.

Reviewers: chad, hach-que

Reviewed By: chad, hach-que

Maniphest Tasks: T9478

Differential Revision: https://secure.phabricator.com/D14226
This commit is contained in:
epriestley 2015-10-02 09:17:51 -07:00
parent 3c4b05bcd4
commit 14d6325394

View file

@ -75,6 +75,12 @@ final class HarbormasterHTTPRequestBuildStepImplementation
list($status, $body, $headers) = $future->resolve();
$header_lines = array();
// TODO: We don't currently preserve the entire "HTTP" response header, but
// should. Once we do, reproduce it here faithfully.
$status_code = $status->getStatusCode();
$header_lines[] = "HTTP {$status_code}";
foreach ($headers as $header) {
list($head, $tail) = $header;
$header_lines[] = "{$head}: {$tail}";
@ -89,7 +95,7 @@ final class HarbormasterHTTPRequestBuildStepImplementation
->newLog($uri, 'http.body')
->append($body);
if ($status->getStatusCode() != 200) {
if ($status->isError()) {
throw new HarbormasterBuildFailureException();
}
}