DiscardHTTPResponse discards the response content by demand
(response *http.Response)
| 113 | |
| 114 | // DiscardHTTPResponse discards the response content by demand |
| 115 | func (s *Session) DiscardHTTPResponse(response *http.Response) { |
| 116 | if response != nil { |
| 117 | _, err := io.Copy(io.Discard, response.Body) |
| 118 | if err != nil { |
| 119 | gologger.Warning().Msgf("Could not discard response body: %s\n", err) |
| 120 | return |
| 121 | } |
| 122 | if closeErr := response.Body.Close(); closeErr != nil { |
| 123 | gologger.Warning().Msgf("Could not close response body: %s\n", closeErr) |
| 124 | } |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | // Close the session |
| 129 | func (s *Session) Close() { |