MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / TestCopy

Function TestCopy

httpheaders/copy_test.go:12–33  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestCopy(t *testing.T) {
13 from := http.Header{
14 "X-Test-1": {"value1", "value2"},
15 "X-Test-2": {"value3"},
16 "X-Test-3": {"value4"},
17 "X-Test-4": nil,
18 }
19
20 to := http.Header{
21 "X-Test-1": {"oldvalue"},
22 "X-Test-4": {"value5"},
23 "X-Test-5": {"value6"},
24 }
25
26 httpheaders.Copy(from, to, []string{"X-Test-1", "x-test-3", "X-Non-Existent"})
27
28 require.Equal(t, []string{"value1", "value2"}, to.Values("X-Test-1"))
29 require.Equal(t, []string{"value4"}, to.Values("X-Test-3"))
30 require.Equal(t, []string{"value5"}, to.Values("X-Test-4"))
31 require.Equal(t, []string{"value6"}, to.Values("X-Test-5"))
32 require.Empty(t, to.Values("X-Test-2"))
33}
34
35func TestCopyAll(t *testing.T) {
36 from := http.Header{

Callers

nothing calls this directly

Calls 1

CopyFunction · 0.92

Tested by

no test coverage detected