Skip to content

Commit

Permalink
Adjusted naming and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
filikos committed Sep 1, 2021
1 parent 100d588 commit 961f495
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,13 @@ func (c *Context) Param(key string) string {
return c.Params.ByName(key)
}

// SetParam adds param to context an
// AddParam adds param to context an
// replaces path param key with given value for e2e testing purposes
// Example Route: "/user/:id"
// SetParam("id", 1)
// AddParam("id", 1)
// Result: "/user/1"
func (c *Context) SetParam(key, value string) {
c.Params = append(c.Params, Param{Key: key,Value: value})
func (c *Context) AddParam(key, value string) {
c.Params = append(c.Params, Param{Key: key, Value: value})
}

// Query returns the keyed url query value if it exists,
Expand Down
4 changes: 2 additions & 2 deletions context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2151,11 +2151,11 @@ func TestContextWithFallbackValueFromRequestContext(t *testing.T) {
}
}

func TestContextSetParam(t *testing.T) {
func TestContextAddParam(t *testing.T) {
c := &Context{}
id := "id"
value := "1"
c.SetParam(id, value)
c.AddParam(id, value)

v, ok := c.Params.Get(id)
assert.Equal(t, ok, true)
Expand Down

0 comments on commit 961f495

Please sign in to comment.