mirror of
https://github.com/labstack/echo.git
synced 2025-01-12 01:22:21 +02:00
Fixed fasthttp set header issue
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
parent
7942e4a77b
commit
13563e9aad
@ -6,11 +6,11 @@ import "github.com/valyala/fasthttp"
|
||||
|
||||
type (
|
||||
RequestHeader struct {
|
||||
fasthttp.RequestHeader
|
||||
*fasthttp.RequestHeader
|
||||
}
|
||||
|
||||
ResponseHeader struct {
|
||||
fasthttp.ResponseHeader
|
||||
*fasthttp.ResponseHeader
|
||||
}
|
||||
)
|
||||
|
||||
@ -30,7 +30,7 @@ func (h *RequestHeader) Set(key, val string) {
|
||||
h.RequestHeader.Set(key, val)
|
||||
}
|
||||
|
||||
func (h *RequestHeader) reset(hdr fasthttp.RequestHeader) {
|
||||
func (h *RequestHeader) reset(hdr *fasthttp.RequestHeader) {
|
||||
h.RequestHeader = hdr
|
||||
}
|
||||
|
||||
@ -50,6 +50,6 @@ func (h *ResponseHeader) Set(key, val string) {
|
||||
h.ResponseHeader.Set(key, val)
|
||||
}
|
||||
|
||||
func (h *ResponseHeader) reset(hdr fasthttp.ResponseHeader) {
|
||||
func (h *ResponseHeader) reset(hdr *fasthttp.ResponseHeader) {
|
||||
h.ResponseHeader = hdr
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ func NewRequest(c *fasthttp.RequestCtx) *Request {
|
||||
return &Request{
|
||||
RequestCtx: c,
|
||||
url: &URL{URI: c.URI()},
|
||||
header: &RequestHeader{c.Request.Header},
|
||||
header: &RequestHeader{&c.Request.Header},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ type (
|
||||
func NewResponse(c *fasthttp.RequestCtx) *Response {
|
||||
return &Response{
|
||||
RequestCtx: c,
|
||||
header: &ResponseHeader{c.Response.Header},
|
||||
header: &ResponseHeader{&c.Response.Header},
|
||||
writer: c,
|
||||
logger: log.New("test"),
|
||||
}
|
||||
|
@ -94,14 +94,14 @@ func (s *Server) Start() {
|
||||
req := s.pool.request.Get().(*Request)
|
||||
reqHdr := s.pool.requestHeader.Get().(*RequestHeader)
|
||||
reqURL := s.pool.url.Get().(*URL)
|
||||
reqHdr.reset(c.Request.Header)
|
||||
reqHdr.reset(&c.Request.Header)
|
||||
reqURL.reset(c.URI())
|
||||
req.reset(c, reqHdr, reqURL)
|
||||
|
||||
// Response
|
||||
res := s.pool.response.Get().(*Response)
|
||||
resHdr := s.pool.responseHeader.Get().(*ResponseHeader)
|
||||
resHdr.reset(c.Response.Header)
|
||||
resHdr.reset(&c.Response.Header)
|
||||
res.reset(c, resHdr)
|
||||
|
||||
s.handler.ServeHTTP(req, res)
|
||||
|
4
glide.lock
generated
4
glide.lock
generated
@ -1,8 +1,8 @@
|
||||
hash: f220137e9ccd9aaf3051be33c3c23ea8abd2c40df6cf96175c3994d482b5e007
|
||||
updated: 2016-03-11T07:51:13.670742959-08:00
|
||||
updated: 2016-03-13T09:34:16.391046379-07:00
|
||||
imports:
|
||||
- name: github.com/klauspost/compress
|
||||
version: 2d3d403f37d2e70b722590bc286076a17422e1f2
|
||||
version: 006acde2c5d283d2f8b8aa03d8f0cd2891c680cf
|
||||
subpackages:
|
||||
- flate
|
||||
- gzip
|
||||
|
Loading…
Reference in New Issue
Block a user