wbhttpclient

package module
v0.0.0-...-e4682f6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg Config, metrics httpMetrics) *client

Types

type Config

type Config struct {
	Name                string
	MaxIdleConnDuration time.Duration
	ReadBufferSize      int
	WriteBufferSize     int
	Host                string
	Timeout             time.Duration
}

type RequestCtx

type RequestCtx struct {
	// contains filtered or unexported fields
}

type RequestOption

type RequestOption func(request *RequestCtx)

func WithBasicAuth

func WithBasicAuth(login, pass string) RequestOption

func WithBearerAuth

func WithBearerAuth(token string) RequestOption

func WithContentType

func WithContentType(contentType string) RequestOption

func WithHeader

func WithHeader(key, value string) RequestOption

func WithHmacAuth

func WithHmacAuth(client, key string) RequestOption

func WithHmacSha256Auth

func WithHmacSha256Auth(client, key string) RequestOption

func WithPathTransformer

func WithPathTransformer(transform func(path string) string) RequestOption

WithPathTransformer applies transform to request path before writing metrics It's critical for preventing prometheus labels filling with dynamic paths like /api/v1/user/123/transaction/41234

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL