diff options
-rw-r--r-- | src/httpRequest.go | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/httpRequest.go b/src/httpRequest.go index 139e0a4..9ad8f9a 100644 --- a/src/httpRequest.go +++ b/src/httpRequest.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "io/ioutil" "log" "net/http" "strings" @@ -19,10 +20,24 @@ func httpRequest(channels channels, threadNr int) { if err != nil { log.Println(err) } else { + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + + if err != nil { + log.Println(err) + } + + responseLines := len(strings.Split(string(body), "\n")) - 1 + responseWords := len(strings.Split(string(body), " ")) + responseChars := len(string(body)) + // define the response var response = Response{ - StatusCode: resp.StatusCode, - FuzzWord: fuzzWord, + StatusCode: resp.StatusCode, + ResponseLines: responseLines, + ResponseWords: responseWords, + ResponseChars: responseChars, + FuzzWord: fuzzWord, } // insert the response into the print channel for further printing |