header

package
v3.57.0-4 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultUserAgent     = "req/v3 (https://github.com/stoney-work/req)"
	UserAgent            = "User-Agent"
	Location             = "Location"
	ContentType          = "Content-Type"
	PlainTextContentType = "text/plain; charset=utf-8"
	JsonContentType      = "application/json; charset=utf-8"
	XmlContentType       = "text/xml; charset=utf-8"
	FormContentType      = "application/x-www-form-urlencoded"
	WwwAuthenticate      = "WWW-Authenticate"
	Authorization        = "Authorization"
	HeaderOderKey        = "__header_order__"
	PseudoHeaderOderKey  = "__pseudo_header_order__"
)

Variables

This section is empty.

Functions

func BuildOrderMap

func BuildOrderMap(orderedKeys []string) map[string]int

BuildOrderMap 根据有序 key 列表预计算 order map,供 SortKeyValuesCached 使用。 应在 client 初始化时调用一次,结果缓存在 Transport 中。

func GetKvsFromPool

func GetKvsFromPool() *[]KeyValues

GetKvsFromPool 从 pool 取一个 []KeyValues 指针。

func IsExcluded

func IsExcluded(key string) bool

func PutKvsToPool

func PutKvsToPool(p *[]KeyValues)

PutKvsToPool 将 []KeyValues 清空后归还 pool,保留底层数组内存。

func SortKeyValues

func SortKeyValues(kvs []KeyValues, orderedKeys []string)

SortKeyValues 原有接口保持不变,供未缓存场景兜底使用。

func SortKeyValuesCached

func SortKeyValuesCached(kvs []KeyValues, order map[string]int)

SortKeyValuesCached 使用预计算好的 order map 排序,避免每次请求重新 make(map)。

Types

type KeyValues

type KeyValues struct {
	Key    string
	Values []string
}

Jump to

Keyboard shortcuts

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