-
Notifications
You must be signed in to change notification settings - Fork 237
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
docs: improve middleware overview #395
Conversation
Signed-off-by: rogerogers <rogers@rogerogers.com>
content/en/docs/hertz/tutorials/basic-feature/middleware/_index.md
Outdated
Show resolved
Hide resolved
|
||
```go | ||
// One way | ||
func MyMiddleware() app.HandlerFunc { | ||
return func(ctx context.Context, c *app.RequestContext) { | ||
// pre-handle | ||
... | ||
// ... | ||
c.Next(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这块是可以加一句,if there is no 'post-handle' logic, the 'c.Next(ctx)' can be omitted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.Next能否忽略的不是说是否存在后处理逻辑,而是后续是否需要保证该中间件和业务handler在一条函数调用栈上;类似panic recovery这种就是没有后处理逻辑,但.Next却必须保留的原因如此
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
24行应该已经说明了
content/zh/docs/hertz/tutorials/basic-feature/middleware/_index.md
Outdated
Show resolved
Hide resolved
content/zh/docs/hertz/tutorials/basic-feature/middleware/_index.md
Outdated
Show resolved
Hide resolved
content/zh/docs/hertz/tutorials/basic-feature/middleware/_index.md
Outdated
Show resolved
Hide resolved
content/zh/docs/hertz/tutorials/basic-feature/middleware/_index.md
Outdated
Show resolved
Hide resolved
Signed-off-by: rogerogers <rogers@rogerogers.com>
done |
* docs: improve middleware overview Signed-off-by: rogerogers <rogers@rogerogers.com> * docs: middleware cr fix Signed-off-by: rogerogers <rogers@rogerogers.com> Signed-off-by: rogerogers <rogers@rogerogers.com>
Signed-off-by: rogerogers rogers@rogerogers.com
What type of PR is this?
docs: improve middleware overview
What this PR does / why we need it (en: English/zh: Chinese):
en: improve middleware overview doc
zh: 优化中间件概览文档
Which issue(s) this PR fixes: