diff --git a/v2/pkg/executer/executer_http.go b/v2/pkg/executer/executer_http.go index 57310af86..6e550db40 100644 --- a/v2/pkg/executer/executer_http.go +++ b/v2/pkg/executer/executer_http.go @@ -101,6 +101,8 @@ func (e *HTTPExecuter) ExecuteHTTP(URL string) (result Result) { result.Extractions = make(map[string]interface{}) dynamicvalues := make(map[string]interface{}) + e.bulkHttpRequest.Reset() + for e.bulkHttpRequest.Next() && !result.Done { httpRequest, err := e.bulkHttpRequest.MakeHTTPRequest(URL, dynamicvalues, e.bulkHttpRequest.Current()) if err != nil { @@ -134,7 +136,6 @@ func (e *HTTPExecuter) handleHTTP(URL string, request *requests.HttpRequest, dyn } fmt.Fprintf(os.Stderr, "%s", string(dumpedRequest)) } - resp, err := e.httpClient.Do(req) if err != nil { if resp != nil { diff --git a/v2/pkg/requests/bulk-http-request.go b/v2/pkg/requests/bulk-http-request.go index a600bbdbe..8bb7c35df 100644 --- a/v2/pkg/requests/bulk-http-request.go +++ b/v2/pkg/requests/bulk-http-request.go @@ -377,7 +377,7 @@ func (r *BulkHTTPRequest) Reset() { r.positionRaw = 0 } func (r *BulkHTTPRequest) Current() string { - if r.positionPath <= len(r.Path) && len(r.Path) != 0 && r.positionRaw == 0 { + if r.positionPath < len(r.Path) && len(r.Path) != 0 { return r.Path[r.positionPath] } @@ -387,16 +387,16 @@ func (r *BulkHTTPRequest) Total() int { return len(r.Path) + len(r.Raw) } -func (r *BulkHTTPRequest) Increment() int { - if r.positionPath <= len(r.Path) && len(r.Path) != 0 && r.positionRaw == 0 { +func (r *BulkHTTPRequest) Increment() { + if len(r.Path) > 0 && r.positionPath < len(r.Path) { r.positionPath++ - return r.positionPath + return } - // if we have payloads increment only when the generators are done - if r.generator == nil { - r.positionRaw++ + if len(r.Raw) > 0 && r.positionRaw < len(r.Raw) { + // if we have payloads increment only when the generators are done + if r.generator == nil { + r.positionRaw++ + } } - - return r.positionPath + r.positionRaw }