diff --git a/domain.go b/domain.go index 49f14a1..55bc178 100644 --- a/domain.go +++ b/domain.go @@ -141,19 +141,20 @@ type RunnerConfig struct { } func (config *RunnerConfig) parseDefaultEndpoint() (*fasthttp.URI, error) { + if config.defaultEndpoint != nil { + return config.defaultEndpoint, nil + } + if config.DefaultEndpoint != "" { - config.defaultEndpoint = &fasthttp.URI{} - err := config.defaultEndpoint.Parse(nil, []byte(config.DefaultEndpoint)) + uri := &fasthttp.URI{} + err := uri.Parse(nil, []byte(config.DefaultEndpoint)) if err != nil { return nil, err } + config.defaultEndpoint = uri return config.defaultEndpoint, err } - if config.defaultEndpoint != nil { - return config.defaultEndpoint, nil - } - return config.defaultEndpoint, errors.New("no valid default endpoint") } diff --git a/loader.go b/loader.go index 520cfcb..f03d67f 100644 --- a/loader.go +++ b/loader.go @@ -119,6 +119,10 @@ func doRequest(config *LoaderConfig,globalCtx util.MapStr,req *fasthttp.Request, err = httpClient.Do(req, resp) } + if global.Env().IsDebug{ + log.Info(resp.String()) + } + duration:=time.Since(start) statsCode:=resp.StatusCode() @@ -376,6 +380,7 @@ func (v *RequestItem) prepareRequest(config *LoaderConfig, globalCtx util.MapStr } if parsedUrl.Host() == nil || len(parsedUrl.Host()) == 0 { path,err:=config.RunnerConfig.parseDefaultEndpoint() + //log.Infof("default endpoint: %v, %v",path,err) if err==nil{ parsedUrl.SetSchemeBytes(path.Scheme()) parsedUrl.SetHostBytes(path.Host())