(ctx context.Context, record capabilityRecord, interceptor pluginapi.StreamChunkInterceptor, req pluginapi.StreamChunkInterceptRequest)
| 551 | } |
| 552 | |
| 553 | func (h *Host) callStreamChunkInterceptor(ctx context.Context, record capabilityRecord, interceptor pluginapi.StreamChunkInterceptor, req pluginapi.StreamChunkInterceptRequest) (out pluginapi.StreamChunkInterceptResponse, ok bool) { |
| 554 | if h == nil || interceptor == nil || h.isPluginFused(record.id) || !h.recordCurrent(record) { |
| 555 | return pluginapi.StreamChunkInterceptResponse{}, false |
| 556 | } |
| 557 | defer func() { |
| 558 | if recovered := recover(); recovered != nil { |
| 559 | h.fusePlugin(record.id, "StreamChunkInterceptor.InterceptStreamChunk", recovered) |
| 560 | out = pluginapi.StreamChunkInterceptResponse{} |
| 561 | ok = false |
| 562 | } |
| 563 | }() |
| 564 | resp, errIntercept := interceptor.InterceptStreamChunk(ctx, req) |
| 565 | if errIntercept != nil { |
| 566 | log.Warnf("pluginhost: stream chunk interceptor %s failed: %v", record.id, errIntercept) |
| 567 | return pluginapi.StreamChunkInterceptResponse{}, false |
| 568 | } |
| 569 | return resp, true |
| 570 | } |
| 571 | |
| 572 | func (h *Host) InterceptRequestBeforeAuth(ctx context.Context, req pluginapi.RequestInterceptRequest) pluginapi.RequestInterceptResponse { |
| 573 | return h.InterceptRequestBeforeAuthExcept(ctx, req, "") |
no test coverage detected