Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 757c8e2

Browse files
authored
Merge pull request #185 from per1234/fix-url-check
Use most appropriate function for checking URL
2 parents 539e940 + 3adc412 commit 757c8e2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

‎internal/rule/rulefunction/library.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ func LibraryPropertiesUrlFieldDeadLink() (result ruleresult.Type, output string)
10111011
}
10121012

10131013
logrus.Tracef("Checking URL: %s", url)
1014-
httpResponse, err := http.Get(url)
1014+
httpResponse, err := http.Head(url)
10151015
if err != nil {
10161016
return ruleresult.Fail, err.Error()
10171017
}

‎internal/rule/rulefunction/library_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ func TestLibraryPropertiesUrlFieldDeadLink(t *testing.T) {
751751
testTables := []libraryRuleFunctionTestTable{
752752
{"Unable to load", "InvalidLibraryProperties", ruleresult.NotRun, ""},
753753
{"Not defined", "MissingFields", ruleresult.NotRun, ""},
754-
{"Bad URL", "BadURL", ruleresult.Fail, "^Get \"http://invalid/\": dial tcp: lookup invalid:"},
754+
{"Bad URL", "BadURL", ruleresult.Fail, "^Head \"http://invalid/\": dial tcp: lookup invalid:"},
755755
{"HTTP error 404", "URL404", ruleresult.Fail, "^404 Not Found$"},
756756
{"Good URL", "Recursive", ruleresult.Pass, ""},
757757
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /