func AddBeforeRequestHook(hks ...BeforeRequestHook) Setter {
	return func(c *Cast) error {
		c.beforeRequestHooks = append(c.beforeRequestHooks, hks...)
		return nil
	}
}
AddBeforeRequestHook adds a before request hook.
package cast
import (
	"fmt"
	"net/http"
	"time"
	"github.com/cep21/circuit/v3"
	"github.com/sirupsen/logrus"
)
type Setter func(cast *Cast) error
func WithBaseURL(url string) Setter {
	return func(c *Cast) error {
		c.baseURL = url
		return nil
	}
}
func WithHeader(h http.Header) Setter {
	return func(c *Cast) error {
		c.header = h
		return nil
	}
}
func SetHeader(vv ...string) Setter {
	return func(c *Cast) error {
		if len(vv)%2 != 0 {
			return fmt.Errorf("vv must have even params")
		}
		for i := 0; i < len(vv); i += 2 {
			c.header.Set(vv[i], vv[i+1])
		}
		return nil
	}
}
func AddHeader(vv ...string) Setter {
	return func(c *Cast) error {
		if len(vv)%2 != 0 {
			return fmt.Errorf("vv must have even params")
		}
		for i := 0; i < len(vv); i += 2 {
			c.header.Add(vv[i], vv[i+1])
		}
		return nil
	}
}
func WithBasicAuth(username, password string) Setter {
	return func(c *Cast) error {
		c.basicAuth = new(BasicAuth)
		c.basicAuth.username = username
		c.basicAuth.password = password
		return nil
	}
}
func WithCookies(cookies ...*http.Cookie) Setter {
	return func(c *Cast) error {
		c.cookies = cookies
		return nil
	}
}
func WithBearerToken(token string) Setter {
	return func(c *Cast) error {
		c.bearerToken = token
		return nil
	}
}
func WithRetry(retry int) Setter {
	return func(c *Cast) error {
		c.retry = retry
		return nil
	}
}
func WithLinearBackoffStrategy(slope time.Duration) Setter {
	return func(c *Cast) error {
		c.stg = linearBackoffStrategy{
			slope: slope,
		}
		return nil
	}
}
func WithConstantBackoffStrategy(internal time.Duration) Setter {
	return func(c *Cast) error {
		c.stg = constantBackOffStrategy{
			interval: internal,
		}
		return nil
	}
}
func WithExponentialBackoffStrategy(base, capacity time.Duration) Setter {
	return func(c *Cast) error {
		c.stg = exponentialBackoffStrategy{
			exponentialBackoff{
				base: base,
				cap:  capacity,
			},
		}
		return nil
	}
}
func WithExponentialBackoffEqualJitterStrategy(base, capacity time.Duration) Setter {
	return func(c *Cast) error {
		c.stg = exponentialBackoffEqualJitterStrategy{
			exponentialBackoff{
				base: base,
				cap:  capacity,
			},
		}
		return nil
	}
}
func WithExponentialBackoffFullJitterStrategy(base, capacity time.Duration) Setter {
	return func(c *Cast) error {
		c.stg = exponentialBackoffFullJitterStrategy{
			exponentialBackoff{
				base: base,
				cap:  capacity,
			},
		}
		return nil
	}
}
func WithExponentialBackoffDecorrelatedJitterStrategy(base, capacity time.Duration) Setter {
	return func(c *Cast) error {
		c.stg = exponentialBackoffDecorrelatedJitterStrategy{
			exponentialBackoff{
				base: base,
				cap:  capacity,
			},
			base,
		}
		return nil
	}
}
func AddRetryHooks(hooks ...RetryHook) Setter {
	return func(c *Cast) error {
		c.retryHooks = append(c.retryHooks, hooks...)
		return nil
	}
}
func AddResponseHooks(hooks ...responseHook) Setter {
	return func(c *Cast) error {
		c.responseHooks = append(c.responseHooks, hooks...)
		return nil
	}
}
func WithHTTPClientTimeout(timeout time.Duration) Setter {
	return func(c *Cast) error {
		c.httpClientTimeout = timeout
		return nil
	}
}