mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-16 21:32:11 +08:00
Adjusted naming and formatting
This commit is contained in:
parent
100d5889b6
commit
961f4951f4
@ -383,12 +383,12 @@ 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) {
|
||||
func (c *Context) AddParam(key, value string) {
|
||||
c.Params = append(c.Params, Param{Key: key, Value: value})
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user