progress tracker fix

This commit is contained in:
Mzack9999 2020-07-21 20:51:58 +02:00
parent b4aabf4b34
commit eee452a8cd
2 changed files with 11 additions and 10 deletions

View File

@ -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 {

View File

@ -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
}