ext

package
v0.0.0-...-574e0c6 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisPatchHook

func DisPatchHook(key string, hooks HooksDict, data any) any

func RegisterHook

func RegisterHook(hooksDict *HooksDict, key string, hook Hook) error

Types

type AuthInter

type AuthInter interface {
	Format(p any) error
}

type BasicAuth

type BasicAuth struct {
	Username string
	Password string
}

func (BasicAuth) Format

func (a BasicAuth) Format(p any) error

type BearerAuth

type BearerAuth struct {
	Token string
}

func (BearerAuth) Format

func (a BearerAuth) Format(p any) error

type Dict

type Dict map[string]string

type Ext

type Ext func(ep *ExtensionPackage)

func AllowRedirects

func AllowRedirects(allowRedirects bool) Ext

func Auth

func Auth(auth AuthInter) Ext

func Cookies

func Cookies(cookies Dict) Ext

func Data

func Data(data Dict) Ext

func Files

func Files(files Dict) Ext

func Headers

func Headers(headers Dict) Ext

func Hooks

func Hooks(hooksDict HooksDict) Ext

func Json

func Json(json map[string]interface{}) Ext

func Params

func Params(params Dict) Ext

func Proxy

func Proxy(proxy string) Ext

func Stream

func Stream(stream io.Reader) Ext

func Timeout

func Timeout(timeout int) Ext

func Verify

func Verify(verify bool) Ext

type ExtensionPackage

type ExtensionPackage struct {
	Method         string // 隐性参数
	Url            string // 直传参数
	Data           Dict   // 以下均为扩展参数
	Params         Dict
	Proxy          string
	Timeout        int
	Headers        Dict
	Cookies        Dict
	AllowRedirects bool
	Json           map[string]interface{}
	Files          Dict
	Stream         io.Reader
	Auth           AuthInter
	Hooks          HooksDict
	Verify         bool
}

type Hook

type Hook func(object any) (error, any)

type HooksDict

type HooksDict map[string][]Hook

func DefaultHooks

func DefaultHooks() HooksDict

type List

type List []string

Jump to

Keyboard shortcuts

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