Skip to content

Commit

Permalink
chore(tests): port tools.http tests from EE
Browse files Browse the repository at this point in the history
  • Loading branch information
fffonion authored and ADD-SP committed Aug 12, 2024
1 parent 0960f88 commit c272b1b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions spec/01-unit/05-utils_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,29 @@ describe("Utils", function()
assert.is_true(tools_http.check_https(true, false))
assert.is_true(tools_http.check_https(true, true))
end)

it("test parsing directive header", function()
-- test null
assert.same(tools_http.parse_directive_header(nil), {})

-- test empty string
assert.same(tools_http.parse_directive_header(""), {})

-- test string
assert.same(tools_http.parse_directive_header("cache-key=kong-cache,cache-age=300"), {
["cache-age"] = 300,
["cache-key"] = "kong-cache",
})

-- test table
assert.same(tools_http.parse_directive_header({
"cache-age=300",
"cache-key=kong-cache",
}), {
["cache-age"] = 300,
["cache-key"] = "kong-cache",
})
end)
end)
end)

Expand Down

0 comments on commit c272b1b

Please sign in to comment.