mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-04-26 21:36:24 +02:00
remove behavior of copyHeaders to copy all headers
Previously, when no keys were specified, copyHeaders would copy all headers from src to dst. I believe this is a remnant of some old code, as we don't actually ever use that behavior today. I'm removing this as it seems too likely to accidentally pass along headers that shouldn't be. Instead, let's always be explicit about which headers to copy (which is what we currently do anyway).
This commit is contained in:
parent
d94e5610d6
commit
0f2deb14d2
2 changed files with 5 additions and 29 deletions
|
|
@ -62,30 +62,12 @@ func TestCopyHeader(t *testing.T) {
|
|||
},
|
||||
|
||||
// copy headers
|
||||
{
|
||||
dst: http.Header{},
|
||||
src: http.Header{"A": []string{"a"}},
|
||||
keys: nil,
|
||||
want: http.Header{"A": []string{"a"}},
|
||||
},
|
||||
{
|
||||
dst: http.Header{"A": []string{"a"}},
|
||||
src: http.Header{"B": []string{"b"}},
|
||||
keys: nil,
|
||||
want: http.Header{"A": []string{"a"}, "B": []string{"b"}},
|
||||
},
|
||||
{
|
||||
dst: http.Header{"A": []string{"a"}},
|
||||
src: http.Header{"B": []string{"b"}, "C": []string{"c"}},
|
||||
keys: []string{"B"},
|
||||
want: http.Header{"A": []string{"a"}, "B": []string{"b"}},
|
||||
},
|
||||
{
|
||||
dst: http.Header{"A": []string{"a1"}},
|
||||
src: http.Header{"A": []string{"a2"}},
|
||||
keys: nil,
|
||||
want: http.Header{"A": []string{"a1", "a2"}},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue