Mzack9999 2020-09-29 00:24:38 +02:00
parent e19ded6b26
commit 0cfe496a4f
1 changed files with 10 additions and 6 deletions

View File

@ -13,12 +13,15 @@ import (
// writeOutputHTTP writes http output to streams // writeOutputHTTP writes http output to streams
func (e *HTTPExecuter) writeOutputHTTP(req *requests.HTTPRequest, resp *http.Response, body string, matcher *matchers.Matcher, extractorResults []string) { func (e *HTTPExecuter) writeOutputHTTP(req *requests.HTTPRequest, resp *http.Response, body string, matcher *matchers.Matcher, extractorResults []string) {
// TODO: RAW REQUESTS var URL string
if req.Request == nil { // rawhttp
return if req.RawRequest != nil {
URL = req.RawRequest.FullURL
}
// retryablehttp
if req.Request != nil {
URL = req.Request.URL.String()
} }
URL := req.Request.URL.String()
if e.jsonOutput { if e.jsonOutput {
output := jsonOutput{ output := jsonOutput{
@ -39,8 +42,9 @@ func (e *HTTPExecuter) writeOutputHTTP(req *requests.HTTPRequest, resp *http.Res
output.ExtractedResults = extractorResults output.ExtractedResults = extractorResults
} }
// TODO: URL should be an argument
if e.jsonRequest { if e.jsonRequest {
dumpedRequest, err := httputil.DumpRequest(req.Request.Request, true) dumpedRequest, err := requests.Dump(req, URL)
if err != nil { if err != nil {
gologger.Warningf("could not dump request: %s\n", err) gologger.Warningf("could not dump request: %s\n", err)
} else { } else {