Better Result initialization with matches and extractions
@@ -132,10 +132,11 @@ func NewHTTPExecuter(options *HTTPOptions) (*HTTPExecuter, error) {
}
func (e *HTTPExecuter) ExecuteParallelHTTP(p progress.IProgress, reqURL string) *Result {
- result := &Result{}
+ result := &Result{
+ Matches: make(map[string]interface{}),
+ Extractions: make(map[string]interface{}),
+ }
- result.Matches = make(map[string]interface{})
- result.Extractions = make(map[string]interface{})
dynamicvalues := make(map[string]interface{})
// verify if the URL is already being processed
@@ -247,8 +248,6 @@ func (e *HTTPExecuter) ExecuteTurboHTTP(p progress.IProgress, reqURL string) *Re
// ExecuteHTTP executes the HTTP request on a URL
func (e *HTTPExecuter) ExecuteHTTP(p progress.IProgress, reqURL string) *Result {
- result := &Result{}
-
// verify if pipeline was requested
if e.bulkHTTPRequest.Pipeline {
return e.ExecuteTurboHTTP(p, reqURL)
@@ -258,8 +257,11 @@ func (e *HTTPExecuter) ExecuteHTTP(p progress.IProgress, reqURL string) *Result
return e.ExecuteParallelHTTP(p, reqURL)
}
- result.Matches = make(map[string]interface{})
- result.Extractions = make(map[string]interface{})
+ result := &Result{
+ Matches: make(map[string]interface{}),
+ Extractions: make(map[string]interface{}),
+ }
+
dynamicvalues := make(map[string]interface{})
// verify if the URL is already being processed
