Documentation ¶
Overview ¶
Package httpclient provides easy way to crate http client with retry and timeout.
Index ¶
Constants ¶
View Source
const ( // DefaultRetry - количество ретраев под текущую реализацию переключения между основными api и failover. DefaultRetry = 2 // DefaultTimeout - стандартное время ожидания ответа от сервера. DefaultTimeout = 3 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backoff ¶
Backoff - provide essention backoff parameters.
func NewBackoff ¶
NewBackoff - return function for new backoff calculation.
type Client ¶
type Client struct { RetryMax int // Количество попыток запроса. Timeout time.Duration // Таймаут для http запроса. Backoff *Backoff // Рассчёт времени ожидания между попытками запроса. HTTP *fasthttp.Client // HTTP клиент. // contains filtered or unexported fields }
Client http.
func NewDefault ¶
func NewDefault() Client
NewDefault - return new http client with default params & backoff.
func NewWithMetric ¶
func NewWithMetric(domain string, latencyMetric *prometheus.HistogramVec) Client
NewDefault - return new http client with default params & backoff.
Click to show internal directories.
Click to hide internal directories.