httpx

package
v0.0.0-...-d22cea1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHttpClient

func NewHttpClient() *http.Client

Types

type RestfulRequest

type RestfulRequest struct {
	Method          string
	Headers         map[string]string
	Params          map[string]string
	Body            string
	Uri             string
	ContentTypeFlag bool
	AcceptFlag      bool
	CookieJar       http.CookieJar
}

func NewRestfulRequest

func NewRestfulRequest(method string, uri string) *RestfulRequest

func (*RestfulRequest) AcceptMIME

func (req *RestfulRequest) AcceptMIME(atype string) error

func (*RestfulRequest) ContentType

func (req *RestfulRequest) ContentType(ctype string, charset string) error

func (*RestfulRequest) SetBody

func (req *RestfulRequest) SetBody(body interface{}, ctype string, charset string) error

func (*RestfulRequest) SetBodyString

func (req *RestfulRequest) SetBodyString(body string, ctype string, charset string) error

type RestfulResponse

type RestfulResponse struct {
	Body       string
	Header     *http.Header
	Cookies    []*http.Cookie
	StatusCode int
}

func RestfulCall

func RestfulCall(req *RestfulRequest) (*RestfulResponse, error)

func RestfulCallCore

func RestfulCallCore(client *http.Client, req *RestfulRequest) (*RestfulResponse, error)

func RestfulCallRetry

func RestfulCallRetry(client *http.Client, req *RestfulRequest, retryTimes int, sleepSeconds int) (*RestfulResponse, error)

func (*RestfulResponse) ResponseBody

func (resp *RestfulResponse) ResponseBody() (map[string]interface{}, error)

func (*RestfulResponse) String

func (resp *RestfulResponse) String() string

Jump to

Keyboard shortcuts

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