httpclient: github.com/tamnd/httpclient Index | Files

package httpclient

import "github.com/tamnd/httpclient"

Index

Package Files

client.go

func Bytes Uses

func Bytes(url string) ([]byte, error)

Bytes fetches the specified url and returns the response body as bytes.

func Download Uses

func Download(urls []string, files *[]File) error

Download downloads multiple files concurrency.

func Files Uses

func Files(urls []string, files *[]File) error

Files downloads multiple files concurrency.

func Get Uses

func Get(url string) (*http.Response, error)

Get issues a GET to the specified URL. It returns an http.Response for further processing.

func JSON Uses

func JSON(url string, v interface{}) error

JSON issues a GET request to a specified URL and unmarshal json data from the response body.

func New Uses

func New() *httpClient

New returns new client.

func Reader Uses

func Reader(url string) (io.ReadCloser, error)

Reader issues a GET request to a specified URL and returns an reader from the response body.

func String Uses

func String(url string) (string, error)

String fetches the specified URL and returns the response body as a string.

func XML Uses

func XML(url string, v interface{}) error

XML issues a GET request to a specified URL and unmarshal xml data from the response body.

type Error Uses

type Error struct {
    Message    string
    StatusCode int
    URL        string
}

Error is the custom error type returns from HTTP requests.

func (*Error) Error Uses

func (e *Error) Error() string

Error returns the error message.

type File Uses

type File struct {
    // File name with no directory.
    Name string

    // Contents of the file.
    Data []byte
}

File represents a file.

Package httpclient imports 7 packages (graph) and is imported by 10 packages. Updated 2016-07-16. Refresh now. Tools for package owners.