httpx

package
v0.0.0-...-3205cb7 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureURL

func EnsureURL(urlOrPath string) string

func IsURL

func IsURL(s string) bool

func RemoveUrlScheme

func RemoveUrlScheme(fullUrl string) string

Types

type Request

type Request struct {
	Method     string            `json:"method"`
	URL        string            `json:"url"`
	Header     map[string]string `json:"header"`
	Base64Body string            `json:"body,omitempty"`
	Retries    int               `json:"retries,omitempty"`
	TimeoutMS  int64             `json:"timeout_ms,omitempty"`
}

func NewGetReq

func NewGetReq(url string, retries int, timeoutMS int64) *Request

func NewGetReqWithHeader

func NewGetReqWithHeader(url string, header map[string]string, retries int) *Request

func NewGetReqs

func NewGetReqs(urls []string, retries int, timeoutMS int64) []*Request

func NewPostWithHeader

func NewPostWithHeader(url string, body []byte, header map[string]string, retries int, timeoutMS int64) *Request

func (*Request) BodyAsBytes

func (req *Request) BodyAsBytes() ([]byte, error)

func (*Request) SetBody

func (req *Request) SetBody(data []byte)

type Response

type Response struct {
	StatusCode int                  `json:"status_code"`
	URL        string               `json:"url"`
	Header     map[string]string    `json:"header"`
	Base64Body string               `json:"body,omitempty"`
	Ex         map[string]*Response `json:"ex,omitempty"`
}

func (*Response) AsBytes

func (resp *Response) AsBytes() ([]byte, error)

func (*Response) ParseFreeJSON

func (resp *Response) ParseFreeJSON(valDec freejson.ValueDecoder) (interface{}, error)

func (*Response) ParseJSON

func (resp *Response) ParseJSON(v interface{}) error

func (*Response) ParseXML

func (resp *Response) ParseXML(v interface{}) error

func (*Response) SetBody

func (resp *Response) SetBody(data []byte)

type ResponseWithError

type ResponseWithError struct {
	*Response
	Err error
}

Directories

Path Synopsis
UserAgent解析与列表。
UserAgent解析与列表。

Jump to

Keyboard shortcuts

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