1
0
mirror of https://github.com/labstack/echo.git synced 2025-07-17 01:43:02 +02:00

Fixed #401 & Godoc

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana
2016-03-14 19:58:46 -07:00
parent 00bf0d651f
commit b10c93cd17
14 changed files with 153 additions and 88 deletions

View File

@ -26,8 +26,8 @@ type (
// response objects, path parameters, data and registered handler.
Context interface {
netContext.Context
SetNetContext(netContext.Context)
NetContext() netContext.Context
SetNetContext(netContext.Context)
Request() engine.Request
Response() engine.Response
Path() string
@ -36,8 +36,8 @@ type (
ParamNames() []string
Query(string) string
Form(string) string
Set(string, interface{})
Get(string) interface{}
Set(string, interface{})
Bind(interface{}) error
Render(int, string, interface{}) error
HTML(int, string) error
@ -90,14 +90,14 @@ func NewContext(req engine.Request, res engine.Response, e *Echo) Context {
}
}
func (c *context) SetNetContext(ctx netContext.Context) {
c.netContext = ctx
}
func (c *context) NetContext() netContext.Context {
return c.netContext
}
func (c *context) SetNetContext(ctx netContext.Context) {
c.netContext = ctx
}
func (c *context) Deadline() (deadline time.Time, ok bool) {
return c.netContext.Deadline()
}
@ -169,11 +169,6 @@ func (c *context) Form(name string) string {
return c.request.FormValue(name)
}
// Get retrieves data from the context.
func (c *context) Get(key string) interface{} {
return c.store[key]
}
// Set saves data in the context.
func (c *context) Set(key string, val interface{}) {
if c.store == nil {
@ -182,6 +177,11 @@ func (c *context) Set(key string, val interface{}) {
c.store[key] = val
}
// Get retrieves data from the context.
func (c *context) Get(key string) interface{} {
return c.store[key]
}
// Bind binds the request body into specified type `i`. The default binder does
// it based on Content-Type header.
func (c *context) Bind(i interface{}) error {