Use most appropriate function for checking URL · arduino/arduino-lint@3adc412 (original) (raw)
File tree
2 files changed
lines changed
- internal/rule/rulefunction
2 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1011,7 +1011,7 @@ func LibraryPropertiesUrlFieldDeadLink() (result ruleresult.Type, output string) | ||
1011 | 1011 | } |
1012 | 1012 | |
1013 | 1013 | logrus.Tracef("Checking URL: %s", url) |
1014 | -httpResponse, err := http.Get(url) | |
1014 | +httpResponse, err := http.Head(url) | |
1015 | 1015 | if err != nil { |
1016 | 1016 | return ruleresult.Fail, err.Error() |
1017 | 1017 | } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -751,7 +751,7 @@ func TestLibraryPropertiesUrlFieldDeadLink(t *testing.T) { | ||
751 | 751 | testTables := []libraryRuleFunctionTestTable{ |
752 | 752 | {"Unable to load", "InvalidLibraryProperties", ruleresult.NotRun, ""}, |
753 | 753 | {"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:"}, | |
755 | 755 | {"HTTP error 404", "URL404", ruleresult.Fail, "^404 Not Found$"}, |
756 | 756 | {"Good URL", "Recursive", ruleresult.Pass, ""}, |
757 | 757 | } |