Skip to content

Commit be3e347

Browse files
committed
Refactor request handling: rename and extract parameter preparation logic into a new function
1 parent 1833103 commit be3e347

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/resty/http.lua

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -903,8 +903,7 @@ function _M.request_pipeline(self, requests)
903903
return responses
904904
end
905905

906-
907-
function _M.request_uri(self, uri, params)
906+
function _M.prepare_request_params(self, uri, params)
908907
params = tbl_copy(params or {}) -- Take by value
909908
if self.proxy_opts then
910909
params.proxy_opts = tbl_copy(self.proxy_opts or {})
@@ -931,6 +930,15 @@ function _M.request_uri(self, uri, params)
931930
end
932931
end
933932

933+
return params
934+
end
935+
936+
function _M.request_uri(self, uri, params)
937+
local params, err = self:prepare_request_params(uri, params)
938+
if not params then
939+
return nil, err
940+
end
941+
934942
local ok, err = self:connect(params)
935943
if not ok then
936944
return nil, err

0 commit comments

Comments
 (0)