Updated homepage 404 check to use explicit parameters and return the status code
This commit is contained in:
parent
482568579b
commit
0a007fc983
@ -564,11 +564,10 @@ class FormulaAuditor
|
|||||||
end
|
end
|
||||||
|
|
||||||
return unless @online
|
return unless @online
|
||||||
begin
|
status_code, = curl_output "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0", \
|
||||||
nostdout { curl "--connect-timeout", "15", "-o", "/dev/null", homepage }
|
"--write-out", "%{http_code}", homepage
|
||||||
rescue ErrorDuringExecution
|
return if status_code.start_with? "20"
|
||||||
problem "The homepage is not reachable (curl exit code #{$?.exitstatus})"
|
problem "The homepage #{homepage} is not reachable (HTTP status code #{status_code})"
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def audit_bottle_spec
|
def audit_bottle_spec
|
||||||
|
|||||||
@ -429,8 +429,8 @@ class FormulaAuditorTests < Homebrew::TestCase
|
|||||||
|
|
||||||
fa.audit_homepage
|
fa.audit_homepage
|
||||||
assert_equal ["The homepage should start with http or https " \
|
assert_equal ["The homepage should start with http or https " \
|
||||||
"(URL is #{fa.formula.homepage}).", "The homepage is not reachable " \
|
"(URL is #{fa.formula.homepage}).", "The homepage #{fa.formula.homepage} is not reachable " \
|
||||||
"(curl exit code #{$?.exitstatus})"], fa.problems
|
"(HTTP status code 000)"], fa.problems
|
||||||
|
|
||||||
formula_homepages = {
|
formula_homepages = {
|
||||||
"bar" => "http://www.freedesktop.org/wiki/bar",
|
"bar" => "http://www.freedesktop.org/wiki/bar",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user