(ctx context.Context, record managementRouteRecord, req pluginapi.ManagementRequest)
| 327 | } |
| 328 | |
| 329 | func (h *Host) callManagementHandler(ctx context.Context, record managementRouteRecord, req pluginapi.ManagementRequest) (resp pluginapi.ManagementResponse, err error) { |
| 330 | if h == nil || record.route.Handler == nil || h.isPluginFused(record.pluginID) || !h.pluginIdentityCurrent(record.pluginID, record.path, record.version) { |
| 331 | return pluginapi.ManagementResponse{}, nil |
| 332 | } |
| 333 | defer func() { |
| 334 | if recovered := recover(); recovered != nil { |
| 335 | h.fusePlugin(record.pluginID, "ManagementHandler.HandleManagement", recovered) |
| 336 | resp = pluginapi.ManagementResponse{} |
| 337 | err = fmt.Errorf("management handler panic: %v", recovered) |
| 338 | } |
| 339 | }() |
| 340 | return record.route.Handler.HandleManagement(ctx, req) |
| 341 | } |
| 342 | |
| 343 | func escapeManagementResponseBody(resp pluginapi.ManagementResponse) []byte { |
| 344 | body, okEscaped := htmlsanitize.JSONBodyIfLikely(resp.Body, resp.Headers.Get("Content-Type")) |
no test coverage detected