request

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(url string, headers H) ([]byte, error)

func Download added in v0.3.2

func Download(url, target string, isGzip bool) (string, error)

func Get

func Get(url string, headers H) ([]byte, error)

func JsonDelete

func JsonDelete(url string, headers H) ([]byte, error)

func JsonPatch

func JsonPatch(url string, query any, headers H) ([]byte, error)

func JsonPost

func JsonPost(url string, query any, headers H) ([]byte, error)

func JsonPut

func JsonPut(url string, query any, headers H) ([]byte, error)

func Patch

func Patch(url, query string, headers H) ([]byte, error)

func Post

func Post(url, query string, headers H) ([]byte, error)

func Put

func Put(url, query string, headers H) ([]byte, error)

func SaveStream added in v0.3.5

func SaveStream(reader io.Reader, target string) (string, error)

func TextGet

func TextGet(url string, headers H) (string, error)

func TextPost

func TextPost(url string, query string, headers H) (string, error)

func TimingGet

func TimingGet(url string, headers H, timeout int64) string

Types

type Client

type Client struct {
	Method  string            `note:"请求方法 GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS|CONNECT|TRACE"`
	Url     string            `note:"请求地址"`
	Data    string            `note:"请求数据"`
	Headers map[string]string `note:"请求头"`
	Timeout time.Duration     `note:"超时时间"`
}

func (*Client) JsonRequest

func (c *Client) JsonRequest() ([]byte, error)

func (*Client) Request

func (c *Client) Request() ([]byte, error)

func (*Client) TextRequest

func (c *Client) TextRequest() (string, error)

type H

type H map[string]string

Jump to

Keyboard shortcuts

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