Merge branch 'master' into content-type

This commit is contained in:
Long Dai 2021-10-27 10:32:23 +08:00 committed by GitHub
commit 426c4589d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -103,7 +103,7 @@ func (m *Middleware) GetHandler(metadata middleware.Metadata) (func(h fasthttp.R
return func(h fasthttp.RequestHandler) fasthttp.RequestHandler {
return func(ctx *fasthttp.RequestCtx) {
if handled := m.evalRequest(ctx, meta, &query); handled {
if allow := m.evalRequest(ctx, meta, &query); !allow {
return
}
h(ctx)

View File

@ -12,7 +12,11 @@ import (
"github.com/dapr/kit/logger"
)
func mockedRequestHandler(ctx *fh.RequestCtx) {}
// mockedRequestHandler acts like an upstream service returns success status code 200 and a fixed response body.
func mockedRequestHandler(ctx *fh.RequestCtx) {
ctx.Response.SetStatusCode(200)
ctx.Response.SetBody([]byte("from mock"))
}
type RequestConfiguator func(*fh.RequestCtx)