1 Star 0 Fork 0

sydeEvans/echo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
header.go 2.15 KB
一键复制 编辑 原始数据 按行查看 历史
anger 提交于 2016-05-23 02:05 . Fix endless loop
// +build !appengine
package fasthttp
import "github.com/valyala/fasthttp"
type (
// RequestHeader holds `fasthttp.RequestHeader`.
RequestHeader struct {
*fasthttp.RequestHeader
}
// ResponseHeader holds `fasthttp.ResponseHeader`.
ResponseHeader struct {
*fasthttp.ResponseHeader
}
)
// Add implements `engine.Header#Add` function.
func (h *RequestHeader) Add(key, val string) {
h.RequestHeader.Add(key, val)
}
// Del implements `engine.Header#Del` function.
func (h *RequestHeader) Del(key string) {
h.RequestHeader.Del(key)
}
// Set implements `engine.Header#Set` function.
func (h *RequestHeader) Set(key, val string) {
h.RequestHeader.Set(key, val)
}
// Get implements `engine.Header#Get` function.
func (h *RequestHeader) Get(key string) string {
return string(h.Peek(key))
}
// Keys implements `engine.Header#Keys` function.
func (h *RequestHeader) Keys() (keys []string) {
keys = make([]string, h.Len())
i := 0
h.VisitAll(func(k, v []byte) {
keys[i] = string(k)
i++
})
return
}
// Contains implements `engine.Header#Contains` function.
func (h *RequestHeader) Contains(key string) bool {
return h.Peek(key) != nil
}
func (h *RequestHeader) reset(hdr *fasthttp.RequestHeader) {
h.RequestHeader = hdr
}
// Add implements `engine.Header#Add` function.
func (h *ResponseHeader) Add(key, val string) {
h.ResponseHeader.Add(key, val)
}
// Del implements `engine.Header#Del` function.
func (h *ResponseHeader) Del(key string) {
h.ResponseHeader.Del(key)
}
// Get implements `engine.Header#Get` function.
func (h *ResponseHeader) Get(key string) string {
return string(h.Peek(key))
}
// Set implements `engine.Header#Set` function.
func (h *ResponseHeader) Set(key, val string) {
h.ResponseHeader.Set(key, val)
}
// Keys implements `engine.Header#Keys` function.
func (h *ResponseHeader) Keys() (keys []string) {
keys = make([]string, h.Len())
i := 0
h.VisitAll(func(k, v []byte) {
keys[i] = string(k)
i++
})
return
}
// Contains implements `engine.Header#Contains` function.
func (h *ResponseHeader) Contains(key string) bool {
return h.Peek(key) != nil
}
func (h *ResponseHeader) reset(hdr *fasthttp.ResponseHeader) {
h.ResponseHeader = hdr
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sydeEvans/echo.git
git@gitee.com:sydeEvans/echo.git
sydeEvans
echo
echo
v2.2.0

搜索帮助