RequestHeader adds or sets (if overridePrev is true) a header to the request.
(overridePrev bool, key string, values ...string)
| 144 | |
| 145 | // RequestHeader adds or sets (if overridePrev is true) a header to the request. |
| 146 | func RequestHeader(overridePrev bool, key string, values ...string) RequestOption { |
| 147 | key = http.CanonicalHeaderKey(key) |
| 148 | |
| 149 | return func(req *http.Request) error { |
| 150 | if overridePrev { // upsert. |
| 151 | req.Header[key] = values |
| 152 | } else { // just insert. |
| 153 | req.Header[key] = append(req.Header[key], values...) |
| 154 | } |
| 155 | |
| 156 | return nil |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | // RequestAuthorization sets an Authorization request header. |
| 161 | // Note that we could do the same with a Transport RoundDrip too. |
no outgoing calls
no test coverage detected
searching dependent graphs…