kataras / kataras/iris

[FEATURE REQUEST] hero.ResultHandler / DispatchCommonHandler

Open
#1,465 8 comments 0 reactions 1 assignee Claimed by @kataras View on GitHub
🚀 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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.