* [#387] Do not escape the "timeout" parameter. When the "timeout" parameter is escaped and turned into a string, it does not pass validation checks. This PR ensures that timeout is passed through as-is, just like "request_timeout". There's no explicit test for this parameter, but I included it on some existing tests just to ensure that the code is exercised. Without the fix in place, one of the tests as modified will not pass. Signed-off-by: Charles Greer <[email protected]> * Unit test for timeout parameter Revert original test modifications. Signed-off-by: Charles Greer <[email protected]> * Extend test and linter Signed-off-by: Charles Greer <[email protected]> --------- Signed-off-by: Charles Greer <[email protected]>
This commit is contained in:
@@ -165,16 +165,17 @@ def query_params(*opensearch_query_params):
|
||||
elif api_key is not None:
|
||||
headers["authorization"] = "ApiKey %s" % (_base64_auth_header(api_key),)
|
||||
|
||||
# don't escape ignore, request_timeout, or timeout
|
||||
for p in ("ignore", "request_timeout", "timeout"):
|
||||
if p in kwargs:
|
||||
params[p] = kwargs.pop(p)
|
||||
|
||||
for p in opensearch_query_params + GLOBAL_PARAMS:
|
||||
if p in kwargs:
|
||||
v = kwargs.pop(p)
|
||||
if v is not None:
|
||||
params[p] = _escape(v)
|
||||
|
||||
# don't treat ignore, request_timeout, and opaque_id as other params to avoid escaping
|
||||
for p in ("ignore", "request_timeout"):
|
||||
if p in kwargs:
|
||||
params[p] = kwargs.pop(p)
|
||||
return func(*args, params=params, headers=headers, **kwargs)
|
||||
|
||||
return _wrapped
|
||||
|
||||
Reference in New Issue
Block a user