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

32 lines
649 B
Go
Raw Normal View History

2016-06-07 04:23:59 +02:00
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"
2016-06-07 04:23:59 +02:00
)
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")
2016-06-07 04:23:59 +02:00
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")))
2016-06-07 04:23:59 +02:00
}