[FEATURE REQUEST] hero.ResultHandler / DispatchCommonHandler
Open
🚀 status:implemented
🪶 type: feature
- Dominant language
- Go
- Stars
- 25.6k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
```go
h := hero.New()
// or func name "ResultHandler"
h.DispatchCommonHandler(func(ctx context.Context,
statusCode int, contentType string, content []byte, v interface{}, err error, found bool) {
// rewrite my result of var "v"
ctx.WriteString("rewrite result:[")
hero.DispatchCommon(ctx, statusCode, contentType, content, v, err, found)
ctx.WriteString("]")
})
app.Handle("GET", "/ping", h.Handler(func(ctx iris.Context) string {
// real response is "rewrite result:[hello]"
return "hello"
}))
```
Contributor guide
Assessment
This issue has not been assessed yet.