Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.7.16: replace *HttpContext to Context interface & fix middleware chain misbehaving in netsed groups #238

Merged
merged 7 commits into from
Jan 25, 2021

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.

1 participant