http

package
v0.0.0-...-977965f Latest Latest
Warning

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

Go to latest
Published: May 28, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a util for common HTTP operations, such Get, Head, Post, Put and Delete. Use Do instead if those methods can not meet your requirement

func NewClient

func NewClient(c *http.Client, modifiers ...modifier.Modifier) *Client

NewClient creates an instance of Client. Use net/http.Client as the default value if c is nil. Modifiers modify the request before sending it.

func (*Client) Delete

func (c *Client) Delete(url string) error

Delete ...

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

Do ...

func (*Client) Get

func (c *Client) Get(url string, v ...interface{}) error

Get ...

func (*Client) Head

func (c *Client) Head(url string) error

Head ...

func (*Client) Post

func (c *Client) Post(url string, v ...interface{}) error

Post ...

func (*Client) Put

func (c *Client) Put(url string, v ...interface{}) error

Put ...

type Error

type Error struct {
	Code    int
	Message string
}

Error wrap HTTP status code and message as an error

func (*Error) Error

func (e *Error) Error() string

Error ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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