MCPcopy Create free account
hub / github.com/kataras/iris / makeServerHandler

Function makeServerHandler

core/router/api_builder.go:1625–1643  ·  view source on GitHub ↗
(givenPathParameter string, handler context.Handler)

Source from the content-addressed store, hash-verified

1623}
1624
1625func makeServerHandler(givenPathParameter string, handler context.Handler) context.Handler {
1626 return func(ctx *context.Context) {
1627 pathValue := ""
1628 if givenPathParameter == "" {
1629 pathValue = ctx.Params().GetEntryAt(ctx.Params().Len() - 1).ValueRaw.(string)
1630 } else {
1631 pathValue = ctx.Params().Get(givenPathParameter)
1632 }
1633
1634 apiPath := "/" + pathValue
1635
1636 r := ctx.Request()
1637 r.URL.Path = apiPath
1638 r.URL.RawPath = apiPath
1639 ctx.Params().Reset()
1640
1641 handler(ctx)
1642 }
1643}
1644
1645func (api *APIBuilder) registerResourceRoute(reqPath string, h context.Handler) *Route {
1646 api.Head(reqPath, h)

Callers 1

HandleServerMethod · 0.85

Calls 7

handlerFunction · 0.90
ParamsMethod · 0.80
RequestMethod · 0.80
LenMethod · 0.65
GetMethod · 0.65
ResetMethod · 0.65
GetEntryAtMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…