Skip to content

Commit

Permalink
Merge pull request #19 from opus-domini/feature/coverage
Browse files Browse the repository at this point in the history
Fix default context initialization
  • Loading branch information
hugo-andrade authored Jul 28, 2024
2 parents f3eb1b1 + 5d58724 commit 449e3fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
3 changes: 1 addition & 2 deletions request_config_base.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package fastshot

import (
"context"
"net/url"
"time"

Expand Down Expand Up @@ -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,
Expand Down
9 changes: 3 additions & 6 deletions wrapper_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
}

0 comments on commit 449e3fd

Please sign in to comment.