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

Method callRequestNormalizer

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

Source from the content-addressed store, hash-verified

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 {
1948 return nil, false
1949 }
1950 defer func() {
1951 if recovered := recover(); recovered != nil {
1952 h.fusePlugin(record.id, "RequestNormalizer.NormalizeRequest", recovered)
1953 out = nil
1954 ok = false
1955 }
1956 }()
1957 resp, errNormalizeRequest := record.plugin.Capabilities.RequestNormalizer.NormalizeRequest(ctx, pluginapi.RequestTransformRequest{
1958 FromFormat: from.String(),
1959 ToFormat: to.String(),
1960 Model: model,
1961 Stream: stream,
1962 Body: bytes.Clone(body),
1963 })
1964 if errNormalizeRequest != nil || len(resp.Body) == 0 {
1965 return nil, false
1966 }
1967 return bytes.Clone(resp.Body), true
1968}
1969
1970func (h *Host) callRequestTranslator(ctx context.Context, record capabilityRecord, from, to sdktranslator.Format, model string, body []byte, stream bool) (out []byte, ok bool) {
1971 if h == nil || h.isPluginFused(record.id) || !h.recordCurrent(record) || record.plugin.Capabilities.RequestTranslator == nil {

Callers 1

NormalizeRequestMethod · 0.95

Calls 6

isPluginFusedMethod · 0.95
recordCurrentMethod · 0.95
fusePluginMethod · 0.95
NormalizeRequestMethod · 0.65
StringMethod · 0.45
CloneMethod · 0.45

Tested by

no test coverage detected