Skip to content

Commit

Permalink
refactor: init context params in new context function
Browse files Browse the repository at this point in the history
  • Loading branch information
vicanso committed Sep 19, 2020
1 parent a40d68e commit 54fda90
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
1 change: 1 addition & 0 deletions context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 54fda90

Please sign in to comment.