Ai
1 Star 0 Fork 0

loll/req

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
header.go 1.27 KB
一键复制 编辑 原始数据 按行查看 历史
loll 提交于 2024-12-04 10:58 +08:00 . first commit
package header
import "strings"
const (
DefaultUserAgent = "LOLL"
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__"
)
var reqWriteExcludeHeader = map[string]bool{
// Host is :authority, already sent.
// Content-Length is automatic.
"host": true,
"content-length": true,
// Per 8.1.2.2 Connection-Specific Header
// Fields, don't send connection-specific
// fields. We have already checked if any
// are error-worthy so just ignore the rest.
"connection": true,
"proxy-connection": true,
"transfer-encoding": true,
"upgrade": true,
"keep-alive": true,
// Ignore header order keys which is only used internally.
HeaderOderKey: true,
PseudoHeaderOderKey: true,
}
func IsExcluded(key string) bool {
if reqWriteExcludeHeader[strings.ToLower(key)] {
return true
}
return false
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lollity/req.git
git@gitee.com:lollity/req.git
lollity
req
req
v1.1.0

搜索帮助