Remove "special" restclient parameters

This commit is contained in:
Clayton Coleman 2017-07-16 00:24:11 -04:00
parent b6d9815b95
commit f0e11c5b09
No known key found for this signature in database
GPG Key ID: 3D16906B4F1C5CB3
2 changed files with 3 additions and 10 deletions

View File

@ -50,10 +50,6 @@ import (
) )
var ( 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 // longThrottleLatency defines threshold for logging requests. All requests being
// throttle for more than longThrottleLatency will be logged. // throttle for more than longThrottleLatency will be logged.
longThrottleLatency = 50 * time.Millisecond 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 // 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 { func (r *Request) RequestURI(uri string) *Request {
if r.err != nil { if r.err != nil {
return r return r
@ -491,10 +487,6 @@ func (r *Request) VersionedParams(obj runtime.Object, codec runtime.ParameterCod
} }
func (r *Request) setParam(paramName, value string) *Request { 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 { if r.params == nil {
r.params = make(url.Values) r.params = make(url.Values)
} }

View File

@ -1515,7 +1515,8 @@ func TestUnacceptableParamNames(t *testing.T) {
testVal string testVal string
expectSuccess bool expectSuccess bool
}{ }{
{"timeout", "42", false}, // timeout is no longer "protected"
{"timeout", "42", true},
} }
for _, item := range table { for _, item := range table {