PrepareClientHeaders returns a copy of the client headers with hop-by-hop, transport, auth, and proxy headers removed.
(clientHeaders http.Header)
| 50 | // PrepareClientHeaders returns a copy of the client headers with hop-by-hop, |
| 51 | // transport, auth, and proxy headers removed. |
| 52 | func PrepareClientHeaders(clientHeaders http.Header) http.Header { |
| 53 | prepared := clientHeaders.Clone() |
| 54 | for _, h := range hopByHopHeaders { |
| 55 | prepared.Del(h) |
| 56 | } |
| 57 | for _, h := range nonForwardedHeaders { |
| 58 | prepared.Del(h) |
| 59 | } |
| 60 | for _, h := range authHeaders { |
| 61 | prepared.Del(h) |
| 62 | } |
| 63 | for _, h := range proxyHeaders { |
| 64 | prepared.Del(h) |
| 65 | } |
| 66 | return prepared |
| 67 | } |
| 68 | |
| 69 | // BuildUpstreamHeaders produces the header set for an upstream SDK request. |
| 70 | // It starts from the prepared client headers, then preserves specific |