libs

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeURL

func MakeURL(scheme, host, path string, args url.Values) string

MakeURL encode to full url request

Types

type HTTPClient

type HTTPClient struct {
	Client *http.Client
}

HTTPClient wrapper for http client

func NewHTTPClient

func NewHTTPClient(timeout time.Duration) *HTTPClient

NewHTTPClient new http client wrapper

func (*HTTPClient) Delete

func (c *HTTPClient) Delete(url string) (statusCode int, err error)

Delete make delete method request

func (*HTTPClient) DownloadFromURL

func (c *HTTPClient) DownloadFromURL(fileURL string) (filename string, rc io.ReadCloser, err error)

// DownloadFromURL download file from url. // Note: rc must be closed after finishing as other ReadCloser.

func (*HTTPClient) Get

func (c *HTTPClient) Get(scheme, host, path string, values url.Values) (body []byte, statusCode int, err error)

Get make get request

func (*HTTPClient) GetWithHeaders

func (c *HTTPClient) GetWithHeaders(fullURL string, headers map[string]string) (body []byte, statusCode int, err error)

GetWithHeaders do get with customer headers

func (*HTTPClient) GetWithURL

func (c *HTTPClient) GetWithURL(fullURL string) (body []byte, statusCode int, err error)

GetWithURL do http get with full url/uri

func (*HTTPClient) PostForm

func (c *HTTPClient) PostForm(_url string, values url.Values) (body []byte, statusCode int, err error)

PostForm do post with post form values

func (*HTTPClient) Upload

func (c *HTTPClient) Upload(uploadURL string, filename string, reader io.Reader, isGzipped bool, mtype string) (respBody []byte, statusCode int, err error)

Upload file content

Jump to

Keyboard shortcuts

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