client

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTimeout      = 10 * time.Second
	MaxIdleConnsPerHost = 50
	MaxConnsPerHost     = 50
)

Variables

This section is empty.

Functions

func TestClient

func TestClient(fn RoundTripFunc) *http.Client

TestClient returns *http.Client with Transport replaced to avoid making real calls

Types

type API

type API struct {
	Client  *http.Client
	BaseURL string
}

API contains client, url and apikey

type Client

type Client struct {
	HttpClient *http.Client
}

func GetTestClient

func GetTestClient(statusCode int, response string) *Client

GetTestClient returns a TestClient

func New

func New() *Client

func (*Client) Get

func (c *Client) Get() (*Client, error)

func (*Client) SetHeader

func (c *Client) SetHeader(token string, request *http.Request) *http.Request

type RoundTripFunc

type RoundTripFunc func(req *http.Request) *http.Response

RoundTripFunc .

func (RoundTripFunc) RoundTrip

func (f RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip .

Jump to

Keyboard shortcuts

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