The debug flags do not work correctly with headless templates (#3030)

* added check on BaseURL

* added debug flag instead on info

* added also debug response flag

* code refactoring
dev
xm1k3 2022-12-20 13:00:34 +01:00 committed by GitHub
parent 71cdb1c335
commit aaae68ee50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -110,14 +110,16 @@ func (request *Request) executeRequestWithPayloads(inputURL string, payloads map
gologger.Verbose().Msgf("Sent Headless request to %s", inputURL)
reqBuilder := &strings.Builder{}
if request.options.Options.Debug || request.options.Options.DebugRequests {
if request.options.Options.Debug || request.options.Options.DebugRequests || request.options.Options.DebugResponse {
gologger.Info().Msgf("[%s] Dumped Headless request for %s", request.options.TemplateID, inputURL)
for _, act := range request.Steps {
reqBuilder.WriteString(act.String())
reqBuilder.WriteString("\n")
actStepStr := act.String()
actStepStr = strings.ReplaceAll(actStepStr, "{{BaseURL}}", inputURL)
reqBuilder.WriteString("\t" + actStepStr + "\n")
}
gologger.Print().Msgf(reqBuilder.String())
gologger.Debug().Msgf(reqBuilder.String())
}
var responseBody string