Skip to content

Commit

Permalink
- updates parameters names to make it explicit
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Biret <[email protected]>
  • Loading branch information
baywet committed Nov 1, 2021
1 parent 5032c16 commit a142eb3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
14 changes: 7 additions & 7 deletions http/go/nethttp/redirect_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,23 @@ type redirectHandlerOptionsInt interface {
}

// Returns the key value to be used when the option is added to the request context
func (o *RedirectHandlerOptions) GetKey() abs.RequestOptionKey {
func (options *RedirectHandlerOptions) GetKey() abs.RequestOptionKey {
return redirectKeyValue
}

// Returns the redirection evaluation function.
func (o *RedirectHandlerOptions) GetShouldRedirect() func(req *nethttp.Request, res *nethttp.Response) bool {
return o.ShouldRedirect
func (options *RedirectHandlerOptions) GetShouldRedirect() func(req *nethttp.Request, res *nethttp.Response) bool {
return options.ShouldRedirect
}

// Returns the maximum number of redirects to follow.
func (o *RedirectHandlerOptions) GetMaxRedirect() int {
if o == nil || o.MaxRedirects < 1 {
func (options *RedirectHandlerOptions) GetMaxRedirect() int {
if options == nil || options.MaxRedirects < 1 {
return defaultMaxRedirects
} else if o.MaxRedirects > absoluteMaxRedirects {
} else if options.MaxRedirects > absoluteMaxRedirects {
return absoluteMaxRedirects
} else {
return o.MaxRedirects
return options.MaxRedirects
}
}

Expand Down
22 changes: 11 additions & 11 deletions http/go/nethttp/retry_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,34 +58,34 @@ var retryKeyValue = abs.RequestOptionKey{
}

// Returns the key value to be used when the option is added to the request context
func (o *RetryHandlerOptions) GetKey() abs.RequestOptionKey {
func (options *RetryHandlerOptions) GetKey() abs.RequestOptionKey {
return retryKeyValue
}

// Returns the should retry callback function
func (o *RetryHandlerOptions) GetShouldRetry() func(delay time.Duration, executionCount int, request *nethttp.Request, response *nethttp.Response) bool {
return o.ShouldRetry
func (options *RetryHandlerOptions) GetShouldRetry() func(delay time.Duration, executionCount int, request *nethttp.Request, response *nethttp.Response) bool {
return options.ShouldRetry
}

// Returns the delays in seconds between retries
func (o *RetryHandlerOptions) GetDelaySeconds() int {
if o.DelaySeconds < 1 {
func (options *RetryHandlerOptions) GetDelaySeconds() int {
if options.DelaySeconds < 1 {
return defaultDelaySeconds
} else if o.DelaySeconds > absoluteMaxDelaySeconds {
} else if options.DelaySeconds > absoluteMaxDelaySeconds {
return absoluteMaxDelaySeconds
} else {
return o.DelaySeconds
return options.DelaySeconds
}
}

// Returns the maximum number of times a request can be retried
func (o *RetryHandlerOptions) GetMaxRetries() int {
if o.MaxRetries < 1 {
func (options *RetryHandlerOptions) GetMaxRetries() int {
if options.MaxRetries < 1 {
return defaultMaxRetries
} else if o.MaxRetries > absoluteMaxRetries {
} else if options.MaxRetries > absoluteMaxRetries {
return absoluteMaxRetries
} else {
return o.MaxRetries
return options.MaxRetries
}
}

Expand Down

0 comments on commit a142eb3

Please sign in to comment.