Adjusted naming and formatting

This commit is contained in:
Niko Filippidis 2021-09-01 13:35:13 +02:00
parent 100d5889b6
commit 961f4951f4
2 changed files with 6 additions and 6 deletions

View File

@ -383,13 +383,13 @@ func (c *Context) Param(key string) string {
return c.Params.ByName(key) 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 // replaces path param key with given value for e2e testing purposes
// Example Route: "/user/:id" // Example Route: "/user/:id"
// SetParam("id", 1) // AddParam("id", 1)
// Result: "/user/1" // Result: "/user/1"
func (c *Context) SetParam(key, value string) { func (c *Context) AddParam(key, value string) {
c.Params = append(c.Params, Param{Key: key,Value: value}) c.Params = append(c.Params, Param{Key: key, Value: value})
} }
// Query returns the keyed url query value if it exists, // Query returns the keyed url query value if it exists,

View File

@ -2151,11 +2151,11 @@ func TestContextWithFallbackValueFromRequestContext(t *testing.T) {
} }
} }
func TestContextSetParam(t *testing.T) { func TestContextAddParam(t *testing.T) {
c := &Context{} c := &Context{}
id := "id" id := "id"
value := "1" value := "1"
c.SetParam(id, value) c.AddParam(id, value)
v, ok := c.Params.Get(id) v, ok := c.Params.Get(id)
assert.Equal(t, ok, true) assert.Equal(t, ok, true)