http

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2020 License: MIT Imports: 7 Imported by: 0

README

http

Package http provides HTTP client

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Response

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

Response represents the response from an HTTP request.

func Get

func Get(url string) *Response

Get issues a GET to the specified URL.

func Head(url string) *Response

Head issues a HEAD to the specified URL.

func Post

func Post(url, contentType string, body io.Reader) *Response

Post issues a POST to the specified URL.

func PostForm

func PostForm(url string, data url.Values) *Response

PostForm issues a POST to the specified URL, with data's keys and values URL-encoded as the request body.

func PostJson

func PostJson(url string, data map[string]interface{}) *Response

PostJson issues a POST to the specified URL, with data json encoding as the request body.

func (*Response) Err

func (r *Response) Err() error

Err returns the response err.

func (*Response) JsonUnmarshal

func (r *Response) JsonUnmarshal(v interface{}) error

JsonUnmarshal parses the JSON-encoded data and stores the result in the value pointed to by v.

func (*Response) Response

func (r *Response) Response() *http.Response

Response returns the response.

func (*Response) Result

func (r *Response) Result() ([]byte, error)

Result returns the response val and err.

func (*Response) String

func (r *Response) String() string

String returns the response body as string.

func (*Response) Val

func (r *Response) Val() []byte

Val returns the response body as []byte.

func (*Response) XmlUnmarshal

func (r *Response) XmlUnmarshal(v interface{}) error

XmlUnmarshal parses the XML-encoded data and stores the result in the value pointed to by v.

Jump to

Keyboard shortcuts

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