Fixed bodyclose

dev
Víctor Zamanillo 2020-10-11 12:14:57 +02:00
parent 21d0b08aaf
commit b3b786a615
1 changed files with 7 additions and 0 deletions

View File

@ -317,6 +317,9 @@ func (e *HTTPExecuter) handleHTTP(reqURL string, request *requests.HTTPRequest,
if request.Pipeline {
resp, err = request.PipelineClient.DoRaw(request.RawRequest.Method, reqURL, request.RawRequest.Path, requests.ExpandMapValues(request.RawRequest.Headers), ioutil.NopCloser(strings.NewReader(request.RawRequest.Data)))
if err != nil {
if resp != nil {
resp.Body.Close()
}
return err
}
} else if request.Unsafe {
@ -328,6 +331,9 @@ func (e *HTTPExecuter) handleHTTP(reqURL string, request *requests.HTTPRequest,
options.AutomaticHostHeader = request.AutomaticHostHeader
resp, err = e.rawHTTPClient.DoRawWithOptions(request.RawRequest.Method, reqURL, request.RawRequest.Path, requests.ExpandMapValues(request.RawRequest.Headers), ioutil.NopCloser(strings.NewReader(request.RawRequest.Data)), options)
if err != nil {
if resp != nil {
resp.Body.Close()
}
return err
}
} else {
@ -340,6 +346,7 @@ func (e *HTTPExecuter) handleHTTP(reqURL string, request *requests.HTTPRequest,
return err
}
}
duration := time.Since(timeStart)
if e.debug {