replace *HttpContext to Context interface & fix middleware chain misbehaving in netsed groups
####Version 1.7.16
- Bug fix: fix middleware chain misbehaving in netsed groups
- Tips: for issue #234, thanks for @LiVe's code
- 2021-01-24 22:00 at ShangHai
####Version 1.7.15
- Tips: replace *HttpContext to Context interface,used to implementation custom Context in dotweb
- feature: add ContextCreater func() Context & HttpServer.SetContextCreater
- refactor: update *HttpContext to Context interface in HttpServer & Middleware & Request
- refactor: add defaultContextCreater used to create Context with HttpContext when HttpServer.ServeHTTP
- example code: example/main.go
- How to use SetContextCreater:
// define
type testContext struct {
dotweb.HttpContext
TestInfo string
}
func testContextCreater() dotweb.Context {
return &testContext{TestInfo:"Test"}
}
// set into dotweb
app.HttpServer.SetContextCreater(testContextCreater)
// use in router
func OutputTestInfo(ctx dotweb.Context) error {
return ctx.WriteString(ctx.(*testContext).TestInfo)
}
- 2021-01-24 18:00 at ShangHai