url

package
v0.0.0-...-7eae5d6 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: GPL-3.0 Imports: 17 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCookies

func NewCookies() *cookiejar.Jar

func NewHeaders

func NewHeaders() *http.Header

初始化Headers结构体

func ParseCookies

func ParseCookies(rawurl string, cookies interface{}) *cookiejar.Jar

func ParseHeaders

func ParseHeaders(headers interface{}) *http.Header

解析Headers字符串为结构体

func SearchStrings

func SearchStrings(str []string, substr string) int

查询下标

Types

type Files

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

Files结构体

func NewFiles

func NewFiles() *Files

初始化Files结构体

func (*Files) AddField

func (fs *Files) AddField(name, value string)

Files添加Field参数

func (*Files) AddFile

func (fs *Files) AddFile(name, fileName, filePath, contentType string)

Files添加File参数

func (*Files) Del

func (fs *Files) Del(name string) bool

删除Files参数

func (*Files) Encode

func (fs *Files) Encode() (*bytes.Buffer, string, error)

Files结构体转FormFile

func (*Files) Get

func (fs *Files) Get(name string) map[string]string

获取Files参数值

func (*Files) SetField

func (fs *Files) SetField(name, value string)

Files设置Field参数

func (*Files) SetFile

func (fs *Files) SetFile(name, fileName, filePath, contentType string)

Files设置File参数

type Params

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

Params结构体

func NewParams

func NewParams() *Params

初始化Params结构体

func ParseParams

func ParseParams(params interface{}) *Params

解析params字符串为Params结构体

func (*Params) Add

func (p *Params) Add(key, value string)

添加Params参数

func (*Params) Del

func (p *Params) Del(key string)

删除Params参数

func (*Params) Encode

func (p *Params) Encode() string

Params结构体转字符串

func (*Params) Get

func (p *Params) Get(key string) string

获取Params参数值

func (*Params) Keys

func (p *Params) Keys() []string

获取Params的所有Key

func (*Params) Set

func (p *Params) Set(key, value string)

设置Params参数

func (*Params) Values

func (p *Params) Values() map[string][]string

Params结构体返回map[string][]string

type Request

type Request struct {
	Params         *Params
	Headers        *http.Header
	Cookies        *cookiejar.Jar
	Data           *Values
	Files          *Files
	Json           map[string]interface{}
	Body           string
	Auth           []string
	Timeout        time.Duration
	AllowRedirects bool
	Proxies        string
	Verify         bool
	Cert           []string
	Ja3            string
	ForceHTTP1     bool
	TLSExtensions  *ja3.TLSExtensions
	HTTP2Settings  *http2.HTTP2Settings
}

func NewRequest

func NewRequest() *Request

type URL

type URL struct {
	Scheme      string        // 协议
	User        *url.Userinfo // 用户信息
	Host        string        // 地址
	Path        string        // 路径
	RawParams   string        // GET参数
	Params      *Params       // GET参数
	RawFragment string        // 原始锚点
	Fragment    string        // 锚点
}

URL结构体

func Parse

func Parse(rawurl string) (*URL, error)

解析URL

func (*URL) String

func (u *URL) String() string

URL结构体转字符串

type Values

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

Values结构体

func NewData

func NewData() *Values

初始化Data结构体

func NewValues

func NewValues() *Values

初始化Values结构体

func ParseData

func ParseData(data interface{}) *Values

解析Data字符串为Values结构体

func ParseValues

func ParseValues(data interface{}) *Values

解析Values字符串为Values结构体

func (*Values) Add

func (v *Values) Add(key, value string)

添加Values参数

func (*Values) Del

func (v *Values) Del(key string)

删除Values参数

func (*Values) Encode

func (v *Values) Encode() string

Values结构体转字符串

func (*Values) Get

func (v *Values) Get(key string) string

获取Values参数值

func (*Values) Keys

func (v *Values) Keys() []string

获取Values的所有Key

func (*Values) Set

func (v *Values) Set(key, value string)

设置Values参数

func (*Values) Values

func (v *Values) Values() map[string][]string

Values结构体返回map[string][]string

Jump to

Keyboard shortcuts

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