From 24591be57a83750906dd02999cf4c3416ca32fed Mon Sep 17 00:00:00 2001 From: Iris Lightshard Date: Wed, 30 Oct 2024 11:33:58 -0600 Subject: [PATCH] close stream body after checking that it's reachable --- grimoire.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/grimoire.go b/grimoire.go index 8b13bee..23a13bd 100644 --- a/grimoire.go +++ b/grimoire.go @@ -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 } }