From 5d3818161f635b82e3289e82ac1ab631f726566b Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Wed, 20 Apr 2022 14:02:33 +0200 Subject: HTTP: Explicitly close request to eliminate EOF errors --- src/http.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/http.go b/src/http.go index 8243500..b247dbb 100644 --- a/src/http.go +++ b/src/http.go @@ -142,6 +142,9 @@ func HTTPMethodWithOpts(method string, url string, opts *HTTPOptionalParams) (ht return nil, nil, &HTTPRequestCreateError{URL: url, Err: reqErr} } + // See https://stackoverflow.com/questions/17714494/golang-http-request-results-in-eof-errors-when-making-multiple-requests-successi + req.Close = true + // Make sure the headers contain all the parameters httpOptionalHeaders(req, opts) -- cgit v1.2.3