Documentation ¶
Index ¶
- type Opt
- func WithBaseURI(data string) Opt
- func WithBody(data any) Opt
- func WithCookies(data any) Opt
- func WithHeaders(data map[string]any) Opt
- func WithMaxConnsPerHost(data int) Opt
- func WithMaxIdleConns(data int) Opt
- func WithMaxIdleConnsPerHost(data int) Opt
- func WithParams(data map[string]any) Opt
- func WithProxy(data string) Opt
- func WithResCharset(data string) Opt
- func WithTimeout(data float32) Opt
- type Options
- type Request
- func (this *Request) Delete(uri string, opts ...Opt) (*Response, error)
- func (this *Request) Download(resourceUrl string, savePath, saveName string, opts ...Opt) (bool, error)
- func (this *Request) Get(uri string, opts ...Opt) (*Response, error)
- func (this *Request) Options(uri string, opts ...Opt) (*Response, error)
- func (this *Request) Patch(uri string, opts ...Opt) (*Response, error)
- func (this *Request) Post(uri string, opts ...Opt) (*Response, error)
- func (this *Request) Put(uri string, opts ...Opt) (*Response, error)
- func (this *Request) Request(method string, uri string, opts ...Opt) (*Response, error)
- func (this *Request) SimpleChineseToUtf8(vBytes []byte) string
- func (this *Request) ToString(i interface{}) string
- func (this *Request) Utf8ToSimpleChinese(vBytes []byte, charset ...string) string
- type Response
- func (this *Response) GetBody() io.ReadCloser
- func (this *Response) GetContentLength() int64
- func (this *Response) GetContents() (bodyStr string, err error)
- func (this *Response) GetCookie(cookieName string) *http.Cookie
- func (this *Response) GetCookies() []*http.Cookie
- func (this *Response) GetHeader(name string) []string
- func (this *Response) GetHeaderLine(name string) string
- func (this *Response) GetHeaders() map[string][]string
- func (this *Response) GetReasonPhrase() string
- func (this *Response) GetRequest() *http.Request
- func (this *Response) GetResponse() *http.Response
- func (this *Response) GetStatusCode() int
- func (this *Response) HasHeader(name string) bool
- func (this *Response) IsTimeout() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { Headers map[string]any BaseURI string Params map[string]any Body any Timeout float32 Cookies any Proxy string ResCharset string MaxIdleConns int MaxConnsPerHost int MaxIdleConnsPerHost int }
*
- 选项 *
- @create 2022-6-29
- @author deatil
type Request ¶
type Request struct { Params string // contains filtered or unexported fields }
*
- 请求 *
- @create 2022-6-29
- @author deatil
func (*Request) Download ¶
func (this *Request) Download(resourceUrl string, savePath, saveName string, opts ...Opt) (bool, error)
Get method download files
func (*Request) SimpleChineseToUtf8 ¶
(接受到的)简体中文 转换为 utf-8
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
*
- 响应 *
- @create 2022-6-29
- @author deatil
func (*Response) GetBody ¶
func (this *Response) GetBody() io.ReadCloser
GetBody parse response body
func (*Response) GetContentLength ¶
Get Response ContentLength
func (*Response) GetHeaderLine ¶
GetHeaderLine get a single response header
func (*Response) GetHeaders ¶
GetHeaders get response headers
func (*Response) GetReasonPhrase ¶
GetReasonPhrase get response reason phrase
func (*Response) GetRequest ¶
GetRequest get request object
func (*Response) GetResponse ¶
GetRequest get request object
func (*Response) GetStatusCode ¶
GetStatusCode get response status code
Click to show internal directories.
Click to hide internal directories.