MCPcopy
hub / github.com/cortesi/devd / inject

Function inject

inject/inject_test.go:10–22  ·  view source on GitHub ↗
(ci CopyInject, data string, contentType string)

Source from the content-addressed store, hash-verified

8)
9
10func inject(ci CopyInject, data string, contentType string) (found bool, dstdata string, err error) {
11 src := bytes.NewBuffer([]byte(data))
12 dst := bytes.NewBuffer(make([]byte, 0))
13 injector, err := ci.Sniff(src, contentType)
14 if err != nil {
15 return false, "", err
16 }
17 _, err = injector.Copy(dst)
18 if err != nil {
19 return false, "", err
20 }
21 return injector.Found(), string(dst.Bytes()), nil
22}
23
24func TestReverseProxyNoInject(t *testing.T) {
25 ci := CopyInject{

Callers 2

TestReverseProxyNoInjectFunction · 0.85
TestReverseProxyFunction · 0.85

Calls 3

SniffMethod · 0.80
CopyMethod · 0.65
FoundMethod · 0.65

Tested by

no test coverage detected