Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Z-Bolt/OctoScreen.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffB42 <10328858+JeffB42@users.noreply.github.com>2021-07-17 07:05:48 +0300
committerGitHub <noreply@github.com>2021-07-17 07:05:48 +0300
commit2ba024b57ba27e71ea2998b4157daa5961fc7afb (patch)
treeefb30fabeefe9c9e559034bcc64876676036e54f
parentb073bbe99cc027589c35750aa6660ea511a02894 (diff)
parentc5924611dd2a7e5166e37a63a3b22a53c43b77bb (diff)
Merge pull request #306 from freman/drainbody
Drain request body before closing
-rwxr-xr-xoctoprintApis/client.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/octoprintApis/client.go b/octoprintApis/client.go
index de7d596..6da7f1a 100755
--- a/octoprintApis/client.go
+++ b/octoprintApis/client.go
@@ -140,7 +140,10 @@ func (this *Client) handleResponse(
) ([]byte, error) {
logger.TraceEnter("Client.handleResponse()")
- defer httpResponse.Body.Close()
+ defer func() {
+ io.Copy(ioutil.Discard, httpResponse.Body)
+ httpResponse.Body.Close()
+ }()
if statusMapping != nil {
if err := statusMapping.Error(httpResponse.StatusCode); err != nil {