Skip to content

Conversation

@devfeel
Copy link
Owner

@devfeel devfeel commented Jan 25, 2021

####Version 1.7.16

  • Bug fix: fix middleware chain misbehaving in netsed groups
  • Tips: for issue group 嵌套及middeware #234, thanks for @LiVe's code
  • 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 22:00 at ShangHai

* refactor: update *HttpContext to Context interface in middleware & request
* refactor: update *HttpContext to Context interface in middleware & request
* tip: 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
* refactor: replace *HttpContext to Context interface,used to implementation custom Context in dotweb
* refactor: update *HttpContext to Context interface in HttpServer & Middleware & Request
* refactor: add defaultContextCreater used to create Context with HttpContext when HttpServer.ServeHTTP
* refactor: add ContextCreater func() Context
* refactor: add HttpServer.SetContextCreater
* 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
* 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
* 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
@devfeel devfeel merged commit 11245a1 into master Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants