Copy copies specified headers from one header to another.
(from, to http.Header, only []string)
| 6 | |
| 7 | // Copy copies specified headers from one header to another. |
| 8 | func Copy(from, to http.Header, only []string) { |
| 9 | for _, key := range only { |
| 10 | key = http.CanonicalHeaderKey(key) |
| 11 | if values := from[key]; len(values) > 0 { |
| 12 | to[key] = append([]string(nil), values...) |
| 13 | } |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | // CopyAll copies all headers from one header to another. |
| 18 | func CopyAll(from, to http.Header, overwrite bool) { |
no outgoing calls