Skip to content

Commit

Permalink
Add Exists() method
Browse files Browse the repository at this point in the history
Signed-off-by: Vishal Rana <[email protected]>
  • Loading branch information
Anon-Penguin authored and vishr committed Apr 24, 2016
1 parent c830734 commit ea12319
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion context.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,12 @@ type (
// Set saves data in the context.
Set(string, interface{})

// Del data from the context
// Del deletes data from the context.
Del(string)

// Exists checks if that key exists in the context.
Exists(string) bool

// Bind binds the request body into provided type `i`. The default binder
// does it based on Content-Type header.
Bind(interface{}) error
Expand Down Expand Up @@ -292,6 +295,11 @@ func (c *context) Del(key string) {
delete(c.store, key)
}

func (c *context) Exists(key string) bool {
_, ok := c.store[key]
return ok
}

func (c *context) Bind(i interface{}) error {
return c.echo.binder.Bind(i, c)
}
Expand Down

0 comments on commit ea12319

Please sign in to comment.