MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / NormalizeResponseAfter

Method NormalizeResponseAfter

internal/pluginhost/adapters.go:1932–1944  ·  view source on GitHub ↗
(ctx context.Context, from, to sdktranslator.Format, model string, originalRequestRawJSON, requestRawJSON, body []byte, stream bool)

Source from the content-addressed store, hash-verified

1930}
1931
1932func (h *Host) NormalizeResponseAfter(ctx context.Context, from, to sdktranslator.Format, model string, originalRequestRawJSON, requestRawJSON, body []byte, stream bool) []byte {
1933 current := bytes.Clone(body)
1934 for _, record := range h.activeRecords() {
1935 normalizer := record.plugin.Capabilities.ResponseAfterTranslator
1936 if h.isPluginFused(record.id) || normalizer == nil {
1937 continue
1938 }
1939 if normalized, ok := h.callResponseNormalizer(ctx, record, "ResponseAfterTranslator.NormalizeResponse", normalizer, from, to, model, originalRequestRawJSON, requestRawJSON, current, stream); ok {
1940 current = normalized
1941 }
1942 }
1943 return current
1944}
1945
1946func (h *Host) callRequestNormalizer(ctx context.Context, record capabilityRecord, from, to sdktranslator.Format, model string, body []byte, stream bool) (out []byte, ok bool) {
1947 if h == nil || h.isPluginFused(record.id) || !h.recordCurrent(record) || record.plugin.Capabilities.RequestNormalizer == nil {

Callers

nothing calls this directly

Calls 4

activeRecordsMethod · 0.95
isPluginFusedMethod · 0.95
CloneMethod · 0.45

Tested by

no test coverage detected