mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-24 20:47:56 +00:00
Remove "special" restclient parameters
Kubernetes-commit: f0e11c5b09abe46dd67a4f5e6f8bce9696888cee
This commit is contained in:
committed by
Kubernetes Publisher
parent
3954f889c7
commit
526a4ea159
@@ -50,10 +50,6 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
// specialParams lists parameters that are handled specially and which users of Request
|
||||
// are therefore not allowed to set manually.
|
||||
specialParams = sets.NewString("timeout")
|
||||
|
||||
// longThrottleLatency defines threshold for logging requests. All requests being
|
||||
// throttle for more than longThrottleLatency will be logged.
|
||||
longThrottleLatency = 50 * time.Millisecond
|
||||
@@ -269,7 +265,7 @@ func (r *Request) AbsPath(segments ...string) *Request {
|
||||
}
|
||||
|
||||
// RequestURI overwrites existing path and parameters with the value of the provided server relative
|
||||
// URI. Some parameters (those in specialParameters) cannot be overwritten.
|
||||
// URI.
|
||||
func (r *Request) RequestURI(uri string) *Request {
|
||||
if r.err != nil {
|
||||
return r
|
||||
@@ -491,10 +487,6 @@ func (r *Request) VersionedParams(obj runtime.Object, codec runtime.ParameterCod
|
||||
}
|
||||
|
||||
func (r *Request) setParam(paramName, value string) *Request {
|
||||
if specialParams.Has(paramName) {
|
||||
r.err = fmt.Errorf("must set %v through the corresponding function, not directly.", paramName)
|
||||
return r
|
||||
}
|
||||
if r.params == nil {
|
||||
r.params = make(url.Values)
|
||||
}
|
||||
|
@@ -1515,7 +1515,8 @@ func TestUnacceptableParamNames(t *testing.T) {
|
||||
testVal string
|
||||
expectSuccess bool
|
||||
}{
|
||||
{"timeout", "42", false},
|
||||
// timeout is no longer "protected"
|
||||
{"timeout", "42", true},
|
||||
}
|
||||
|
||||
for _, item := range table {
|
||||
|
Reference in New Issue
Block a user