1
0
mirror of https://github.com/labstack/echo.git synced 2025-11-29 22:48:07 +02:00

Context#Form() > Context#FormValue(), Context#Query() > Context#QueryParam()

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana
2016-03-21 13:10:20 -07:00
parent 3d656d1808
commit 703174e58f
6 changed files with 41 additions and 23 deletions

View File

@@ -210,17 +210,17 @@ func TestContextPath(t *testing.T) {
assert.Equal(t, "/users/:uid/files/:fid", c.Path())
}
func TestContextQuery(t *testing.T) {
func TestContextQueryParam(t *testing.T) {
q := make(url.Values)
q.Set("name", "joe")
q.Set("email", "joe@labstack.com")
req := test.NewRequest(GET, "/?"+q.Encode(), nil)
c := NewContext(req, nil, New())
assert.Equal(t, "joe", c.Query("name"))
assert.Equal(t, "joe@labstack.com", c.Query("email"))
assert.Equal(t, "joe", c.QueryParam("name"))
assert.Equal(t, "joe@labstack.com", c.QueryParam("email"))
}
func TestContextForm(t *testing.T) {
func TestContextFormValue(t *testing.T) {
f := make(url.Values)
f.Set("name", "joe")
f.Set("email", "joe@labstack.com")
@@ -229,8 +229,8 @@ func TestContextForm(t *testing.T) {
req.Header().Add(ContentType, ApplicationForm)
c := NewContext(req, nil, New())
assert.Equal(t, "joe", c.Form("name"))
assert.Equal(t, "joe@labstack.com", c.Form("email"))
assert.Equal(t, "joe", c.FormValue("name"))
assert.Equal(t, "joe@labstack.com", c.FormValue("email"))
}
func TestContextNetContext(t *testing.T) {