From 4fce3b30774f291fc0f85a0e07a2db3ac209435e Mon Sep 17 00:00:00 2001 From: Qi Date: Mon, 12 Aug 2024 17:26:53 +0800 Subject: [PATCH] tests(tools): test against read-only table returned by `kong.tools.http.parse_directive_header()` --- spec/01-unit/05-utils_spec.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spec/01-unit/05-utils_spec.lua b/spec/01-unit/05-utils_spec.lua index f93d682f4f89..ad4ec5a365ca 100644 --- a/spec/01-unit/05-utils_spec.lua +++ b/spec/01-unit/05-utils_spec.lua @@ -181,6 +181,11 @@ describe("Utils", function() end) it("test parsing directive header", function() + -- EMPTY table return by the function with `nil` should be read-only + assert.is_false(pcall(function() + tools_http.parse_directive_header(nil)["foo"] = "bar" + end)) + -- test null assert.same(tools_http.parse_directive_header(nil), {})