This commit is contained in:
Max Lerebourg
2022-09-29 14:01:33 +02:00
parent 2569f26805
commit b545eac5a8
+2 -3
View File
@@ -304,7 +304,7 @@ func handleStreamCache(a *Bouncer, initialized bool) {
a.crowdsecStreamHealthy = true a.crowdsecStreamHealthy = true
} }
func crowdsecQuery(a *Bouncer, stringURL string) ([]byte) { func crowdsecQuery(a *Bouncer, stringURL string) []byte {
req, _ := http.NewRequest(http.MethodGet, stringURL, nil) req, _ := http.NewRequest(http.MethodGet, stringURL, nil)
req.Header.Add(crowdsecAuthHeader, a.crowdsecKey) req.Header.Add(crowdsecAuthHeader, a.crowdsecKey)
res, err := a.client.Do(req) res, err := a.client.Do(req)
@@ -318,7 +318,7 @@ func crowdsecQuery(a *Bouncer, stringURL string) ([]byte) {
a.crowdsecStreamHealthy = false a.crowdsecStreamHealthy = false
return nil return nil
} }
defer func (body io.ReadCloser) { defer func(body io.ReadCloser) {
err = body.Close() err = body.Close()
if err != nil { if err != nil {
log.Printf("failed to close body reader: %s", err) log.Printf("failed to close body reader: %s", err)
@@ -332,4 +332,3 @@ func crowdsecQuery(a *Bouncer, stringURL string) ([]byte) {
} }
return body return body
} }