httpClient

package
v2.9.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractHeader added in v2.0.11

func ExtractHeader(res *http.Response, target string) ([]string, error)

Extract the given http header values Return error when the given http header was not found

Types

type RestClient

type RestClient interface {
	RestClientDelete
	RestClientGet
	RestClientPost
	RestClientPut
	WithAuthentication(tokenSource oauth2.TokenSource) RestClient
	WithHeader(key, value string) RestClient
	WithTransport(tr http.RoundTripper) RestClient
	WithTimeout(timeout time.Duration) RestClient
}

func New

func New() RestClient

func NewWithClient

func NewWithClient(client *http.Client) RestClient

type RestClientDelete added in v2.4.2

type RestClientDelete interface {
	Delete(ctx context.Context, url string) (*http.Response, error)
	DeleteJson(ctx context.Context, url string, body interface{}) (*http.Response, error)
}

type RestClientGet added in v2.4.2

type RestClientGet interface {
	Get(ctx context.Context, url string) (*http.Response, error)
	GetAsJson(ctx context.Context, url string, bodyTarget interface{}, responseHandler func(response *http.Response) error) error
}

type RestClientPost added in v2.4.2

type RestClientPost interface {
	Post(ctx context.Context, url string) (*http.Response, error)
	PostJson(ctx context.Context, url string, body interface{}) (*http.Response, error)
	PostMultipart(ctx context.Context, url string, multipartWriter func(writer *multipart.Writer) error) (*http.Response, error)
	PostMultipartChunked(ctx context.Context, url string, multipartWriter func(writer *multipart.Writer)) (*http.Response, error)
}

type RestClientPut added in v2.4.2

type RestClientPut interface {
	Put(ctx context.Context, url string) (*http.Response, error)
	PutJson(ctx context.Context, url string, body interface{}) (*http.Response, error)
}

Jump to

Keyboard shortcuts

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