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

26 lines
604 B
Go

package standard
import (
"bufio"
"net/http"
"net/url"
"strings"
"testing"
"github.com/labstack/echo/engine/test"
"github.com/labstack/gommon/log"
"github.com/stretchr/testify/assert"
)
func TestRequest(t *testing.T) {
httpReq, _ := http.ReadRequest(bufio.NewReader(strings.NewReader(test.MultipartRequest)))
url, _ := url.Parse("http://github.com/labstack/echo")
httpReq.URL = url
httpReq.RemoteAddr = "127.0.0.1"
req := NewRequest(httpReq, log.New("echo"))
test.RequestTest(t, req)
nr, _ := http.NewRequest("GET", "/", nil)
req.reset(nr, nil, nil)
assert.Equal(t, "", req.Host())
}