(ctx context.Context, record capabilityRecord, method string, normalizer pluginapi.ResponseNormalizer, from, to sdktranslator.Format, model string, originalRequestRawJSON, requestRawJSON, body []byte, stream bool)
| 1992 | } |
| 1993 | |
| 1994 | func (h *Host) callResponseNormalizer(ctx context.Context, record capabilityRecord, method string, normalizer pluginapi.ResponseNormalizer, from, to sdktranslator.Format, model string, originalRequestRawJSON, requestRawJSON, body []byte, stream bool) (out []byte, ok bool) { |
| 1995 | if h == nil || normalizer == nil || h.isPluginFused(record.id) || !h.recordCurrent(record) { |
| 1996 | return nil, false |
| 1997 | } |
| 1998 | defer func() { |
| 1999 | if recovered := recover(); recovered != nil { |
| 2000 | h.fusePlugin(record.id, method, recovered) |
| 2001 | out = nil |
| 2002 | ok = false |
| 2003 | } |
| 2004 | }() |
| 2005 | resp, errNormalizeResponse := normalizer.NormalizeResponse(ctx, pluginapi.ResponseTransformRequest{ |
| 2006 | FromFormat: from.String(), |
| 2007 | ToFormat: to.String(), |
| 2008 | Model: model, |
| 2009 | Stream: stream, |
| 2010 | OriginalRequest: bytes.Clone(originalRequestRawJSON), |
| 2011 | TranslatedRequest: bytes.Clone(requestRawJSON), |
| 2012 | Body: bytes.Clone(body), |
| 2013 | }) |
| 2014 | if errNormalizeResponse != nil || len(resp.Body) == 0 { |
| 2015 | return nil, false |
| 2016 | } |
| 2017 | return bytes.Clone(resp.Body), true |
| 2018 | } |
| 2019 | |
| 2020 | func (h *Host) callResponseTranslator(ctx context.Context, record capabilityRecord, translator pluginapi.ResponseTranslator, from, to sdktranslator.Format, model string, originalRequestRawJSON, requestRawJSON, body []byte, stream bool) (out []byte, ok bool) { |
| 2021 | if h == nil || translator == nil || h.isPluginFused(record.id) || !h.recordCurrent(record) { |
no test coverage detected