remove old auth header on Auth() call
This commit is contained in:
parent
9babe85048
commit
6142a1100c
@ -153,7 +153,10 @@ func HeadersMap(headers map[string]string) RequestModifier {
|
||||
}
|
||||
|
||||
func Auth(auth AuthProvider) RequestModifier {
|
||||
return Headers("Authentication", auth())
|
||||
return chainMods(
|
||||
RemoveHeaders("Authentication"),
|
||||
Headers("Authentication", auth()),
|
||||
)
|
||||
}
|
||||
|
||||
func Basic(username, password string) AuthProvider {
|
||||
|
10
utils.go
Normal file
10
utils.go
Normal file
@ -0,0 +1,10 @@
|
||||
package ezhttp
|
||||
|
||||
func chainMods(mods ...RequestModifier) RequestModifier {
|
||||
return func(r *RequestBuilder) *RequestBuilder {
|
||||
for _, mod := range mods {
|
||||
r = mod(r)
|
||||
}
|
||||
return r
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user