diff --git a/lib/resty/http.lua b/lib/resty/http.lua index a85f85a..99c5181 100644 --- a/lib/resty/http.lua +++ b/lib/resty/http.lua @@ -903,8 +903,7 @@ function _M.request_pipeline(self, requests) return responses end - -function _M.request_uri(self, uri, params) +function _M.prepare_request_params(self, uri, params) params = tbl_copy(params or {}) -- Take by value if self.proxy_opts then params.proxy_opts = tbl_copy(self.proxy_opts or {}) @@ -931,6 +930,15 @@ function _M.request_uri(self, uri, params) end end + return params +end + +function _M.request_uri(self, uri, params) + local params, err = self:prepare_request_params(uri, params) + if not params then + return nil, err + end + local ok, err = self:connect(params) if not ok then return nil, err