mirror of
https://github.com/labstack/echo.git
synced 2024-11-24 08:22:21 +02:00
9795e59c43
Signed-off-by: Vishal Rana <vr@labstack.com>
89 lines
1.9 KiB
Go
89 lines
1.9 KiB
Go
// +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` method.
|
|
func (h *RequestHeader) Add(key, val string) {
|
|
// h.RequestHeader.Add(key, val)
|
|
}
|
|
|
|
// Del implements `engine.Header#Del` method.
|
|
func (h *RequestHeader) Del(key string) {
|
|
h.RequestHeader.Del(key)
|
|
}
|
|
|
|
// Set implements `engine.Header#Set` method.
|
|
func (h *RequestHeader) Set(key, val string) {
|
|
h.RequestHeader.Set(key, val)
|
|
}
|
|
|
|
// Get implements `engine.Header#Get` method.
|
|
func (h *RequestHeader) Get(key string) string {
|
|
return string(h.Peek(key))
|
|
}
|
|
|
|
// Keys implements `engine.Header#Keys` method.
|
|
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
|
|
}
|
|
|
|
func (h *RequestHeader) reset(hdr *fasthttp.RequestHeader) {
|
|
h.RequestHeader = hdr
|
|
}
|
|
|
|
// Add implements `engine.Header#Add` method.
|
|
func (h *ResponseHeader) Add(key, val string) {
|
|
// TODO: https://github.com/valyala/fasthttp/issues/69
|
|
// h.header.Add(key, val)
|
|
}
|
|
|
|
// Del implements `engine.Header#Del` method.
|
|
func (h *ResponseHeader) Del(key string) {
|
|
h.ResponseHeader.Del(key)
|
|
}
|
|
|
|
// Get implements `engine.Header#Get` method.
|
|
func (h *ResponseHeader) Get(key string) string {
|
|
return string(h.Peek(key))
|
|
}
|
|
|
|
// Set implements `engine.Header#Set` method.
|
|
func (h *ResponseHeader) Set(key, val string) {
|
|
h.ResponseHeader.Set(key, val)
|
|
}
|
|
|
|
// Keys implements `engine.Header#Keys` method.
|
|
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
|
|
}
|
|
|
|
func (h *ResponseHeader) reset(hdr *fasthttp.ResponseHeader) {
|
|
h.ResponseHeader = hdr
|
|
}
|