MCPcopy
hub / github.com/projectdiscovery/subfinder / DiscardHTTPResponse

Method DiscardHTTPResponse

pkg/subscraping/agent.go:115–126  ·  view source on GitHub ↗

DiscardHTTPResponse discards the response content by demand

(response *http.Response)

Source from the content-addressed store, hash-verified

113
114// DiscardHTTPResponse discards the response content by demand
115func (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
129func (s *Session) Close() {

Callers 15

RunMethod · 0.80
RunMethod · 0.80
RunMethod · 0.80
RunMethod · 0.80
RunMethod · 0.80
RunMethod · 0.80
RunMethod · 0.80
RunMethod · 0.80
RunMethod · 0.80
RunMethod · 0.80
RunMethod · 0.80
RunMethod · 0.80

Calls 1

CloseMethod · 0.80

Tested by

no test coverage detected