1
0
mirror of https://github.com/labstack/echo.git synced 2025-01-10 00:28:23 +02:00
echo/engine/fasthttp/request_test.go
Vishal Rana fa80ead5e2 Closes #576
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-06-21 14:50:57 -07:00

32 lines
649 B
Go

package fasthttp
import (
"bufio"
"bytes"
"net"
"net/url"
"testing"
"github.com/labstack/echo/engine/test"
"github.com/labstack/gommon/log"
fast "github.com/valyala/fasthttp"
)
type fakeAddr struct {
addr string
net.Addr
}
func (a fakeAddr) String() string {
return a.addr
}
func TestRequest(t *testing.T) {
ctx := new(fast.RequestCtx)
url, _ := url.Parse("http://github.com/labstack/echo")
ctx.Init(&fast.Request{}, fakeAddr{addr: "127.0.0.1"}, nil)
ctx.Request.Read(bufio.NewReader(bytes.NewBufferString(test.MultipartRequest)))
ctx.Request.SetRequestURI(url.String())
test.RequestTest(t, NewRequest(ctx, log.New("echo")))
}