Skip to content

Commit

Permalink
Read from an ioutil.ReadAll without losing HTTP response content (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulSec authored Oct 15, 2020
1 parent 6e02bb2 commit 4254dfb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/resp_analysis.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package pkg

import (
"bytes"
"gochopchop/data"
"io/ioutil"
"log"
Expand All @@ -15,6 +16,9 @@ func ResponseAnalysis(resp *http.Response, signature data.Check) bool {
if err != nil {
log.Fatal(err)
}
// Restore the io.ReadCloser to its original state
resp.Body = ioutil.NopCloser(bytes.NewBuffer(bodyBytes))

bodyString := string(bodyBytes)

if signature.StatusCode != nil {
Expand Down

0 comments on commit 4254dfb

Please sign in to comment.