// Copy returns a deep copy of the HeadersRewrite func (h HeadersRewrite) Copy() HeadersRewrite { return HeadersRewrite{ RemoveHeaders: utils.CopyStringSlice(h.RemoveHeaders), AddHeaders: h.AddHeaders.Copy(), SetHeaders: h.SetHeaders.Copy(), } }
// Copy makes a deep copy of the HeaderPairs func (h HeaderPairs) Copy() HeaderPairs { var res = make(HeaderPairs) for key, value := range h { res[key] = utils.CopyStringSlice(value) } return res }
// CopyHeadersWithout copies headers from `from` to `to` except for the `exceptions` func CopyHeadersWithout(from, to http.Header, exceptions ...string) { for k := range from { shouldCopy := true for _, e := range exceptions { if e == k { shouldCopy = false break } } if shouldCopy { to[k] = utils.CopyStringSlice(from[k]) } } }
// CopyHeaders copies all headers from `from` to `to`. func CopyHeaders(from, to http.Header) { for k := range from { to[k] = utils.CopyStringSlice(from[k]) } }