diff --git a/request_config_base.go b/request_config_base.go index 8fcf231..28e9bee 100644 --- a/request_config_base.go +++ b/request_config_base.go @@ -1,7 +1,6 @@ package fastshot import ( - "context" "net/url" "time" @@ -151,7 +150,7 @@ func (c *RetryConfig) SetJitterStrategy(strategy JitterStrategy) { // NewRequestConfigBase creates a new request configuration. func newRequestConfigBase(method method.Type, path string) *RequestConfigBase { return &RequestConfigBase{ - ctx: newDefaultContext(context.Background()), + ctx: newDefaultContext(), httpHeader: newDefaultHttpHeader(), httpCookies: newDefaultHttpCookies(), method: method, diff --git a/wrapper_context.go b/wrapper_context.go index 5f6b021..f9b59af 100644 --- a/wrapper_context.go +++ b/wrapper_context.go @@ -22,12 +22,9 @@ func (c *DefaultContext) Set(ctx context.Context) { } } -// newDefaultContext initializes a new DefaultContext with a given context. -func newDefaultContext(ctx context.Context) *DefaultContext { - if ctx == nil { - ctx = context.Background() - } +// newDefaultContext initializes a new DefaultContext. +func newDefaultContext() *DefaultContext { return &DefaultContext{ - ctx: ctx, + ctx: context.Background(), } }