Fetch

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 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 added in v0.0.7

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

Query 查询请求与响应

func ReleaseRequest added in v0.0.7

func ReleaseRequest(ctx *Ctx)

func SetHostHeadOption added in v0.0.6

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 added in v0.0.7

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

func NewClient added in v0.0.7

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

func (*Client) Json added in v0.0.7

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

type Ctx added in v0.0.7

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

func AcquireCtx added in v0.0.7

func AcquireCtx() *Ctx

func (*Ctx) Reset added in v0.0.7

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 added in v0.0.6

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