mirror of
https://github.com/labstack/echo.git
synced 2024-11-24 08:22:21 +02:00
Minor fixes to fasthttp
Signed-off-by: Vishal Rana <vishal.rana@verizon.com>
This commit is contained in:
parent
7b843e66c5
commit
4982169106
33
echo.go
33
echo.go
@ -25,23 +25,22 @@ import (
|
||||
|
||||
type (
|
||||
Echo struct {
|
||||
prefix string
|
||||
middleware []MiddlewareFunc
|
||||
http2 bool
|
||||
maxParam *int
|
||||
notFoundHandler HandlerFunc
|
||||
defaultHTTPErrorHandler HTTPErrorHandler
|
||||
httpErrorHandler HTTPErrorHandler
|
||||
binder Binder
|
||||
renderer Renderer
|
||||
pool sync.Pool
|
||||
debug bool
|
||||
hook engine.HandlerFunc
|
||||
autoIndex bool
|
||||
engineType engine.Type
|
||||
engine engine.Engine
|
||||
router *Router
|
||||
logger logger.Logger
|
||||
prefix string
|
||||
middleware []MiddlewareFunc
|
||||
http2 bool
|
||||
maxParam *int
|
||||
notFoundHandler HandlerFunc
|
||||
httpErrorHandler HTTPErrorHandler
|
||||
binder Binder
|
||||
renderer Renderer
|
||||
pool sync.Pool
|
||||
debug bool
|
||||
hook engine.HandlerFunc
|
||||
autoIndex bool
|
||||
engineType engine.Type
|
||||
engine engine.Engine
|
||||
router *Router
|
||||
logger logger.Logger
|
||||
}
|
||||
|
||||
Route struct {
|
||||
|
@ -15,6 +15,7 @@ type (
|
||||
}
|
||||
|
||||
Request interface {
|
||||
Host() string
|
||||
URI() string
|
||||
URL() URL
|
||||
Header() Header
|
||||
|
@ -1,6 +1,10 @@
|
||||
package fasthttp
|
||||
|
||||
import "io"
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/engine"
|
||||
@ -23,8 +27,8 @@ func NewRequest(c *fasthttp.RequestCtx) *Request {
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Request) Object() interface{} {
|
||||
return r.context
|
||||
func (r *Request) Host() string {
|
||||
return string(r.context.Host())
|
||||
}
|
||||
|
||||
func (r *Request) URI() string {
|
||||
@ -48,10 +52,13 @@ func (r *Request) Method() string {
|
||||
}
|
||||
|
||||
func (r *Request) Body() io.ReadCloser {
|
||||
// return r.context.PostBody()
|
||||
return nil
|
||||
return ioutil.NopCloser(bytes.NewBuffer(r.context.PostBody()))
|
||||
}
|
||||
|
||||
func (r *Request) FormValue(name string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (r *Request) Object() interface{} {
|
||||
return r.context
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ func NewRequest(r *http.Request) *Request {
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Request) Object() interface{} {
|
||||
return r.request
|
||||
func (r *Request) Host() string {
|
||||
return r.Host()
|
||||
}
|
||||
|
||||
func (r *Request) URL() engine.URL {
|
||||
@ -55,6 +55,10 @@ func (r *Request) FormValue(name string) string {
|
||||
return r.request.FormValue(name)
|
||||
}
|
||||
|
||||
func (r *Request) Object() interface{} {
|
||||
return r.request
|
||||
}
|
||||
|
||||
func (r *Request) reset(req *http.Request, h engine.Header, u engine.URL) {
|
||||
r.request = req
|
||||
r.header = h
|
||||
|
@ -29,10 +29,6 @@ func NewResponse(w http.ResponseWriter, l logger.Logger) *Response {
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Response) Object() interface{} {
|
||||
return r.response
|
||||
}
|
||||
|
||||
func (r *Response) Header() engine.Header {
|
||||
return r.header
|
||||
}
|
||||
@ -73,6 +69,10 @@ func (r *Response) Writer() io.Writer {
|
||||
return r.writer
|
||||
}
|
||||
|
||||
func (r *Response) Object() interface{} {
|
||||
return r.response
|
||||
}
|
||||
|
||||
func (r *Response) reset(w http.ResponseWriter, h engine.Header) {
|
||||
r.response = w
|
||||
r.header = h
|
||||
|
Loading…
Reference in New Issue
Block a user