(ctx context.Context, record capabilityRecord, method string, call func(context.Context, pluginapi.RequestInterceptRequest) (pluginapi.RequestInterceptResponse, error), req pluginapi.RequestInterceptRequest)
| 513 | } |
| 514 | |
| 515 | func (h *Host) callRequestInterceptor(ctx context.Context, record capabilityRecord, method string, call func(context.Context, pluginapi.RequestInterceptRequest) (pluginapi.RequestInterceptResponse, error), req pluginapi.RequestInterceptRequest) (out pluginapi.RequestInterceptResponse, ok bool) { |
| 516 | if h == nil || call == nil || h.isPluginFused(record.id) || !h.recordCurrent(record) { |
| 517 | return pluginapi.RequestInterceptResponse{}, false |
| 518 | } |
| 519 | defer func() { |
| 520 | if recovered := recover(); recovered != nil { |
| 521 | h.fusePlugin(record.id, method, recovered) |
| 522 | out = pluginapi.RequestInterceptResponse{} |
| 523 | ok = false |
| 524 | } |
| 525 | }() |
| 526 | resp, errIntercept := call(ctx, req) |
| 527 | if errIntercept != nil { |
| 528 | log.Warnf("pluginhost: request interceptor %s failed: %v", record.id, errIntercept) |
| 529 | return pluginapi.RequestInterceptResponse{}, false |
| 530 | } |
| 531 | return resp, true |
| 532 | } |
| 533 | |
| 534 | func (h *Host) callResponseInterceptor(ctx context.Context, record capabilityRecord, interceptor pluginapi.ResponseInterceptor, req pluginapi.ResponseInterceptRequest) (out pluginapi.ResponseInterceptResponse, ok bool) { |
| 535 | if h == nil || interceptor == nil || h.isPluginFused(record.id) || !h.recordCurrent(record) { |
no test coverage detected