mirror of https://github.com/gin-gonic/gin.git
Context.Engine renamed to Context.engine
This commit is contained in:
parent
880dd7f3cf
commit
5f76ba2022
|
@ -70,7 +70,7 @@ type Context struct {
|
||||||
handlers HandlersChain
|
handlers HandlersChain
|
||||||
index int8
|
index int8
|
||||||
|
|
||||||
Engine *Engine
|
engine *Engine
|
||||||
Keys map[string]interface{}
|
Keys map[string]interface{}
|
||||||
Errors errorMsgs
|
Errors errorMsgs
|
||||||
Accepted []string
|
Accepted []string
|
||||||
|
@ -328,7 +328,7 @@ func (c *Context) Render(code int, r render.Render) {
|
||||||
// It also updates the HTTP code and sets the Content-Type as "text/html".
|
// It also updates the HTTP code and sets the Content-Type as "text/html".
|
||||||
// See http://golang.org/doc/articles/wiki/
|
// See http://golang.org/doc/articles/wiki/
|
||||||
func (c *Context) HTML(code int, name string, obj interface{}) {
|
func (c *Context) HTML(code int, name string, obj interface{}) {
|
||||||
instance := c.Engine.HTMLRender.Instance(name, obj)
|
instance := c.engine.HTMLRender.Instance(name, obj)
|
||||||
c.Render(code, instance)
|
c.Render(code, instance)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ func createTestContext() (c *Context, w *httptest.ResponseRecorder, r *Engine) {
|
||||||
func TestContextReset(t *testing.T) {
|
func TestContextReset(t *testing.T) {
|
||||||
router := New()
|
router := New()
|
||||||
c := router.allocateContext()
|
c := router.allocateContext()
|
||||||
assert.Equal(t, c.Engine, router)
|
assert.Equal(t, c.engine, router)
|
||||||
|
|
||||||
c.index = 2
|
c.index = 2
|
||||||
c.Writer = &responseWriter{ResponseWriter: httptest.NewRecorder()}
|
c.Writer = &responseWriter{ResponseWriter: httptest.NewRecorder()}
|
||||||
|
@ -110,7 +110,7 @@ func TestContextCopy(t *testing.T) {
|
||||||
assert.Equal(t, cp.Request, c.Request)
|
assert.Equal(t, cp.Request, c.Request)
|
||||||
assert.Equal(t, cp.index, AbortIndex)
|
assert.Equal(t, cp.index, AbortIndex)
|
||||||
assert.Equal(t, cp.Keys, c.Keys)
|
assert.Equal(t, cp.Keys, c.Keys)
|
||||||
assert.Equal(t, cp.Engine, c.Engine)
|
assert.Equal(t, cp.engine, c.engine)
|
||||||
assert.Equal(t, cp.Params, c.Params)
|
assert.Equal(t, cp.Params, c.Params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
gin.go
2
gin.go
|
@ -90,7 +90,7 @@ func Default() *Engine {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (engine *Engine) allocateContext() (context *Context) {
|
func (engine *Engine) allocateContext() (context *Context) {
|
||||||
return &Context{Engine: engine}
|
return &Context{engine: engine}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (engine *Engine) LoadHTMLGlob(pattern string) {
|
func (engine *Engine) LoadHTMLGlob(pattern string) {
|
||||||
|
|
Loading…
Reference in New Issue