Skip to content

Commit

Permalink
stricter check for url exists, getgauge/gauge#1019
Browse files Browse the repository at this point in the history
  • Loading branch information
sriv committed Apr 24, 2018
1 parent 29b7a2f commit 6570674
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions common.go
Original file line number Diff line number Diff line change
Expand Up @@ -690,12 +690,12 @@ func (property *Property) String() string {
func UrlExists(url string) (bool, error) {
resp, err := http.Head(url)
if err != nil {
return false, fmt.Errorf("Failed to resolve host.")
return false, fmt.Errorf("Failed to resolve host")
}
if resp.StatusCode == 404 {
return false, fmt.Errorf("File does not exist.")
if resp.StatusCode == 200 {
return true, nil
}
return true, nil
return false, fmt.Errorf("Could not get %s, %d-%s", url, resp.StatusCode, resp.Status)
}

// GetPluginProperties returns the properties of the given plugin.
Expand Down

0 comments on commit 6570674

Please sign in to comment.