(givenPathParameter string, handler context.Handler)
| 1623 | } |
| 1624 | |
| 1625 | func 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 | |
| 1645 | func (api *APIBuilder) registerResourceRoute(reqPath string, h context.Handler) *Route { |
| 1646 | api.Head(reqPath, h) |
no test coverage detected
searching dependent graphs…