Added stop-at-first-match to http requests

dev
Ice3man543 2021-08-26 02:09:14 +05:30
parent fb2ec8f5d2
commit 18d0858f31
2 changed files with 4 additions and 1 deletions

View File

@ -161,6 +161,9 @@ type Request struct {
//
// This allows matching on them later for multi-request conditions.
ReqCondition bool `yaml:"req-condition,omitempty" jsonschema:"title=preserve request history,description=Automatically assigns numbers to requests and preserves their history"`
// description: |
// StopAtFirstMatch stops the execution of the requests as soon as a match is found.
StopAtFirstMatch bool `yaml:"stop-at-first-match,omitempty" jsonschema:"title=stop at first match,description=Stop the execution after a match is found"`
}
// GetID returns the unique ID of the request if any.

View File

@ -249,7 +249,7 @@ func (r *Request) ExecuteWithResults(reqURL string, dynamicValues, previous outp
requestCount++
r.options.Progress.IncrementRequests()
if request.original.options.Options.StopAtFirstMatch && gotOutput {
if (request.original.options.Options.StopAtFirstMatch || r.StopAtFirstMatch) && gotOutput {
r.options.Progress.IncrementErrorsBy(int64(generator.Total()))
break
}