Skip to content

Commit

Permalink
refactor(tools): update references of tools.utils to correct module (
Browse files Browse the repository at this point in the history
…#13162)

This is a follow-up of [#13156](#13156), clean some references of `tools.utils`.

KAG-3136
  • Loading branch information
chronolaw authored Jun 5, 2024
1 parent fb5d828 commit c39b654
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
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

1 comment on commit c39b654

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bazel Build

Docker image available kong/kong:c39b654f78893e43e943562629a3be9b065eabe6
Artifacts available https://github.com/Kong/kong/actions/runs/9378635076

Please sign in to comment.