Fetch

package
v0.0.0-...-be7a3bd Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EasyJson

func EasyJson(endpoint string, reqData EasyJsonSerialization, respData EasyJsonSerialization, options ...Option) error

EasyJson 使用easyJson接口的json请求与响应

func Json

func Json(endpoint string, reqData any, respData any, options ...Option) error

Json json请求与响应

func Query

func Query(endpoint string, reqData *fasthttp.Args, options ...Option) (string, error)

Query 查询请求与响应

func ReleaseRequest

func ReleaseRequest(ctx *Ctx)

func SetHostHeadOption

func SetHostHeadOption(req *fasthttp.Request)

SetHostHeadOption 设置host头

func Text

func Text(endpoint string, reqData string, options ...Option) (string, error)

Text text请求与响应

func UseCompressOption

func UseCompressOption(req *fasthttp.Request)

UseCompressOption 设置请求优先使用压缩

func UseGetOption

func UseGetOption(req *fasthttp.Request)

UseGetOption 设置GET请求

Types

type Client

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

func NewClient

func NewClient(proxy string, options ...Option) *Client

func (*Client) Json

func (c *Client) Json(ctx *Ctx, endpoint string, reqData any, respData any, options ...Option) error

type Ctx

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

func AcquireCtx

func AcquireCtx() *Ctx

func (*Ctx) Reset

func (c *Ctx) Reset()

type EasyJsonSerialization

type EasyJsonSerialization interface {
	MarshalJSON() ([]byte, error)
	UnmarshalJSON(data []byte) error
}

type Option

type Option func(req *fasthttp.Request)

func SetCustomHostHeadOption

func SetCustomHostHeadOption(host string) Option

SetCustomHostHeadOption 设置用户自定义host头

Jump to

Keyboard shortcuts

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