close stream body after checking that it's reachable

This commit is contained in:
Iris Lightshard 2024-10-30 11:33:58 -06:00
parent a66f2ae368
commit 24591be57a
Signed by: nilix
GPG key ID: 688407174966CAF3

View file

@ -21,13 +21,15 @@ func withTitleAndStreamsAndSentry(next http.Handler, cfg Config, sentry *Sentry)
return http.HandlerFunc(handlerFunc)
}
type Sentry struct {}
type Sentry struct {
}
func (self *Sentry) GetStatus(url string) int {
resp, err := http.Get(url)
if err != nil {
return 500
} else {
resp.Body.Close()
return resp.StatusCode
}
}