Documentation
¶
Index ¶
- func WithBaseHeaders(h map[string]string) option
- func WithCircuitBreaker(timeout time.Duration, failureThreshold, successThreshold uint32, ...) option
- func WithCircuitBreakerEnabled(enabled bool) option
- func WithLogMWEnabled(enabled bool) option
- func WithLogger(l *slog.Logger) option
- func WithOtelMWEnabled(enabled bool) option
- func WithPaths(p map[string]string) option
- func WithPropagator(p propagation.TextMapPropagator) option
- func WithServiceVersion(version string) option
- func WithTracer(t trace.TracerProvider) option
- func WithTransport(t *http.Transport) option
- type Client
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithBaseHeaders ¶ added in v0.2.0
func WithCircuitBreaker ¶ added in v0.4.0
func WithCircuitBreaker( timeout time.Duration, failureThreshold, successThreshold uint32, policies ...func(*http.Response) bool, ) option
WithCircuitBreaker accepts:
- timeout - duration window for circuit breaker to determine the state
- failureThreshold - number of failures that must occur within the timeout duration to transition to Open state
- successThreshold - number of successes that must occur to transition from Half-Open state to Closed state
- policies - determine whether a request is failed or successful by evaluating the response instance
passing zero values will result to default values: 10s, 3, 1, Status Code 500 and above
func WithCircuitBreakerEnabled ¶ added in v0.4.0
func WithCircuitBreakerEnabled(enabled bool) option
func WithLogMWEnabled ¶
func WithLogMWEnabled(enabled bool) option
func WithLogger ¶
func WithOtelMWEnabled ¶
func WithOtelMWEnabled(enabled bool) option
func WithPropagator ¶
func WithPropagator(p propagation.TextMapPropagator) option
func WithServiceVersion ¶ added in v0.1.1
func WithServiceVersion(version string) option
func WithTracer ¶
func WithTracer(t trace.TracerProvider) option
func WithTransport ¶
Types ¶
type Client ¶ added in v0.1.2
func (*Client) NewRequest ¶ added in v0.5.0
NewRequest returns *resty.Request from given context.
It sets default headers "Content-Type" to "application/json" and "User-Agent" based on the client name and version.
Click to show internal directories.
Click to hide internal directories.