Skip to content

Commit bc7698d

Browse files
committed
Only add successful web cache deception requests to the report
1 parent 87bc2d5 commit bc7698d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

pkg/deception.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -166,20 +166,20 @@ func webCacheDeceptionTemplate(repResult *reportResult, appendStr string) error
166166
Print(msg, Green)
167167
msg = "Curl: " + repRequest.CurlCommand + "\n\n"
168168
Print(msg, Green)
169+
170+
repRequest.URL = req.URL.String()
171+
// Dump the request without the body
172+
var dumpReqBytes []byte
173+
dumpReqBytes, _ = httputil.DumpRequest(req, false)
174+
repRequest.Request = string(dumpReqBytes)
175+
// Dump the response
176+
responseBytes, _ := httputil.DumpResponse(resp, true)
177+
repRequest.Response = string(responseBytes)
178+
179+
repResult.Requests = append(repResult.Requests, repRequest)
169180
} else {
170181
PrintVerbose("Curl command: "+repRequest.CurlCommand+"\n", NoColor, 2)
171182
}
172183

173-
repRequest.URL = req.URL.String()
174-
// Dump the request without the body
175-
var dumpReqBytes []byte
176-
dumpReqBytes, _ = httputil.DumpRequest(req, false)
177-
repRequest.Request = string(dumpReqBytes)
178-
// Dump the response
179-
responseBytes, _ := httputil.DumpResponse(resp, true)
180-
repRequest.Response = string(responseBytes)
181-
182-
repResult.Requests = append(repResult.Requests, repRequest)
183-
184184
return nil
185185
}

0 commit comments

Comments
 (0)