allow user to overwrite user-agent header

pull/773/head
hunterlong 2020-08-03 04:03:31 -07:00
parent f089364884
commit aeaba54f82
1 changed files with 4 additions and 3 deletions

View File

@ -177,6 +177,10 @@ func HttpRequest(endpoint, method string, content interface{}, headers []string,
req.Header.Set("Content-Type", content.(string))
}
// set default headers so end user can overwrite them if needed
req.Header.Set("User-Agent", "Statping")
req.Header.Set("Statping-Version", Version)
verifyHost := req.URL.Hostname()
for _, h := range headers {
keyVal := strings.SplitN(h, "=", 2)
@ -192,9 +196,6 @@ func HttpRequest(endpoint, method string, content interface{}, headers []string,
}
}
req.Header.Set("User-Agent", "Statping")
req.Header.Set("Statping-Version", Version)
var resp *http.Response
dialer := &net.Dialer{