httpclient

package
v0.0.0-...-1ae172a Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PostFile

func PostFile(url, filename, filepath string) ([]byte, error)

Types

type HttpClient

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

func NewHttpClient

func NewHttpClient(baseUrl string) (*HttpClient, error)

func (*HttpClient) Delete

func (c *HttpClient) Delete(path string, body interface{}, v interface{}, options RequestOptions) (*http.Response, error)

func (*HttpClient) Do

func (c *HttpClient) Do(req *http.Request, v interface{}) (*http.Response, error)

func (*HttpClient) Get

func (c *HttpClient) Get(path string, query interface{}, v interface{}, options RequestOptions) (*http.Response, error)

func (*HttpClient) NewRequest

func (c *HttpClient) NewRequest(method, reqPath string, params interface{}, options RequestOptions) (*http.Request, error)

func (*HttpClient) Post

func (c *HttpClient) Post(path string, body interface{}, v interface{}, options RequestOptions) (*http.Response, error)

func (*HttpClient) Put

func (c *HttpClient) Put(path string, body interface{}, v interface{}, options RequestOptions) (*http.Response, error)

type RequestOptions

type RequestOptions struct {
	Header  http.Header
	Context context.Context
}

func (*RequestOptions) WithContext

func (o *RequestOptions) WithContext(ctx context.Context)

func (*RequestOptions) WithHeader

func (o *RequestOptions) WithHeader(name, value string)

func (*RequestOptions) WithHeaders

func (o *RequestOptions) WithHeaders(headers map[string]string)

Jump to

Keyboard shortcuts

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