diff --git a/context.go b/context.go index f3af90c..701df68 100644 --- a/context.go +++ b/context.go @@ -624,5 +624,6 @@ func NewContext(resp http.ResponseWriter, req *http.Request) *Context { c := &Context{} c.Request = req c.Response = resp + c.Params = new(RouteParams) return c } diff --git a/context_test.go b/context_test.go index 94daa0d..3ebc855 100644 --- a/context_test.go +++ b/context_test.go @@ -79,6 +79,7 @@ func TestContext(t *testing.T) { data := "abcd" assert := assert.New(t) c := NewContext(nil, nil) + assert.NotNil(c.Params) c.WriteHeader(http.StatusBadRequest) assert.Equal(c.StatusCode, http.StatusBadRequest) _, err := c.Write([]byte(data))