net

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

*

@author: fanyanan
@date: 2022/6/8
@note: //request operation interface

*

*

@author: fanyanan
@date: 2022/6/8
@note: //network request body

*

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Export

func Export(v interface{}) string

func IntByte

func IntByte(v interface{}) []byte

func Json

func Json(v interface{}) string

Types

type Client

type Client struct {
}

func (*Client) CheckRedirect

func (c *Client) CheckRedirect(v func(req *http.Request, via []*http.Request) error) *Request

func (*Client) Debug

func (c *Client) Debug(v bool) *Request

Debug model

func (*Client) Delete

func (c *Client) Delete(url string, data ...interface{}) (string, error)

Delete is a delete http request

func (*Client) DisableKeepAlives

func (c *Client) DisableKeepAlives(v bool) *Request

func (*Client) Get

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

Get is a get http request

func (*Client) JSON

func (c *Client) JSON() *Request

func (*Client) Jar

func (c *Client) Jar(v http.CookieJar) *Request

func (*Client) NewRequest

func (c *Client) NewRequest() *Request

func (*Client) Post

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

func (*Client) Proxy

func (c *Client) Proxy(v func(*http.Request) (*url.URL, error)) *Request

func (*Client) Put

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

Put is a put http request

func (*Client) SetCookies

func (c *Client) SetCookies(cookies map[string]string) *Request

func (*Client) SetHeaders

func (c *Client) SetHeaders(headers map[string]string) *Request

func (*Client) SetTLSClient

func (c *Client) SetTLSClient(v *tls.Config) *Request

func (*Client) SetTimeout

func (c *Client) SetTimeout(d time.Duration) *Request

func (*Client) TLSClient

func (c *Client) TLSClient(v *tls.Config) *Request

func (*Client) Transport

func (c *Client) Transport(v *http.Transport) *Request

func (*Client) UploadFilePath

func (c *Client) UploadFilePath(url, filename, filePath string) (string, error)

UploadFilePath File upload via file path

type Request

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

Request request subject

func (*Request) CheckRedirect

func (r *Request) CheckRedirect(v func(req *http.Request, via []*http.Request) error) *Request

func (*Request) Debug

func (r *Request) Debug(v bool) *Request

Debug model

func (*Request) Delete

func (r *Request) Delete(url string, data ...interface{}) (string, error)

Delete is a delete http request

func (*Request) DisableKeepAlives

func (r *Request) DisableKeepAlives(v bool) *Request

func (*Request) Get

func (r *Request) Get(url string, data ...interface{}) (string, error)

Get is a get http request

func (*Request) JSON

func (r *Request) JSON() *Request

func (*Request) Jar

func (r *Request) Jar(v http.CookieJar) *Request

func (*Request) Post

func (r *Request) Post(url string, data ...interface{}) (string, error)

Post is a post http request

func (*Request) Proxy

func (r *Request) Proxy(v func(*http.Request) (*url.URL, error)) *Request

func (*Request) Put

func (r *Request) Put(url string, data ...interface{}) (string, error)

Put is a put http request

func (*Request) SetCookies

func (r *Request) SetCookies(cookies map[string]string) *Request

Set cookies

func (*Request) SetHeaders

func (r *Request) SetHeaders(headers map[string]string) *Request

Set headers

func (*Request) SetTLSClient

func (r *Request) SetTLSClient(v *tls.Config) *Request

func (*Request) SetTimeout

func (r *Request) SetTimeout(d time.Duration) *Request

func (*Request) TLSClient

func (r *Request) TLSClient(v *tls.Config) *Request

func (*Request) Transport

func (r *Request) Transport(v *http.Transport) *Request

func (*Request) UploadFilePath

func (r *Request) UploadFilePath(url, filename, fileinput string) (string, error)

UploadFilePath file

type Response

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

func (*Response) Body

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

func (*Response) Close

func (r *Response) Close() error

func (*Response) Content

func (r *Response) Content() (string, error)

func (*Response) Cookies

func (r *Response) Cookies() []*http.Cookie

func (*Response) Export

func (r *Response) Export() (string, error)

func (*Response) Headers

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

func (*Response) Json

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

func (*Response) Response

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

func (*Response) StatusCode

func (r *Response) StatusCode() int

func (*Response) Time

func (r *Response) Time() string

func (*Response) Unmarshal

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

func (*Response) Url

func (r *Response) Url() string

Jump to

Keyboard shortcuts

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