Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(tools): update references of tools.utils to correct module #13162

Merged
merged 4 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion kong/plugins/file-log/handler.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
-- Copyright (C) Kong Inc.
require "kong.tools.utils" -- ffi.cdefs
local kong_meta = require "kong.meta"


Expand Down
2 changes: 1 addition & 1 deletion kong/tools/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ do
"kong.tools.rand",
"kong.tools.time",
"kong.tools.string",
-- ]] keep it here for compatibility
"kong.tools.ip",
"kong.tools.http",
-- ]] keep it here for compatibility
}

for _, str in ipairs(modules) do
Expand Down
6 changes: 3 additions & 3 deletions spec/helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ end
-- @param opts table with options. See [lua-resty-http](https://github.com/pintsized/lua-resty-http)
function resty_http_proxy_mt:send(opts, is_reopen)
local cjson = require "cjson"
local utils = require "kong.tools.utils"
local encode_args = require("kong.tools.http").encode_args

opts = opts or {}

Expand All @@ -709,7 +709,7 @@ function resty_http_proxy_mt:send(opts, is_reopen)
opts.body = cjson.encode(opts.body)

elseif string.find(content_type, "www-form-urlencoded", nil, true) and t_body_table then
opts.body = utils.encode_args(opts.body, true, opts.no_array_indexes)
opts.body = encode_args(opts.body, true, opts.no_array_indexes)

elseif string.find(content_type, "multipart/form-data", nil, true) and t_body_table then
local form = opts.body
Expand Down Expand Up @@ -738,7 +738,7 @@ function resty_http_proxy_mt:send(opts, is_reopen)

-- build querystring (assumes none is currently in 'opts.path')
if type(opts.query) == "table" then
local qs = utils.encode_args(opts.query)
local qs = encode_args(opts.query)
opts.path = opts.path .. "?" .. qs
opts.query = nil
end
Expand Down
13 changes: 10 additions & 3 deletions spec/helpers/http_mock/nginx_instance.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@ local error = error
local assert = assert
local ngx = ngx
local io = io
-- It can't be changed to kong.tools.table because the old version
-- does not have kong/tools/table.lua, so the upgrade test will fail.
local shallow_copy = require("kong.tools.utils").shallow_copy

local shallow_copy
do
local clone = require "table.clone"

shallow_copy = function(orig)
assert(type(orig) == "table")
return clone(orig)
end
end

local template = assert(pl_template.compile(template_str))
local render_env = {ipairs = ipairs, pairs = pairs, error = error, }
Expand Down
Loading