mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #50639 from simo5/setheader
Automatic merge from submit-queue (batch tested with PRs 50023, 50639) Extend SetHeader Requests method ito accept multiple values This allows to set headers that are multivalued directly. The headers variable is not directly accessible and currently SetHeaders allows to set only one value. ```release-note NONE ```
This commit is contained in:
commit
039f898c07
@ -322,11 +322,14 @@ func (r *Request) setParam(paramName, value string) *Request {
|
||||
return r
|
||||
}
|
||||
|
||||
func (r *Request) SetHeader(key, value string) *Request {
|
||||
func (r *Request) SetHeader(key string, values ...string) *Request {
|
||||
if r.headers == nil {
|
||||
r.headers = http.Header{}
|
||||
}
|
||||
r.headers.Set(key, value)
|
||||
r.headers.Del(key)
|
||||
for _, value := range values {
|
||||
r.headers.Add(key, value)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user