(ci CopyInject, data string, contentType string)
| 8 | ) |
| 9 | |
| 10 | func 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 | |
| 24 | func TestReverseProxyNoInject(t *testing.T) { |
| 25 | ci := CopyInject{ |
no test coverage detected