From 3dd5fb0468977c6626fe4a0ea7b95222f14da09f Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Sat, 29 Aug 2026 20:05:00 +0200 Subject: Apply code review suggestions Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/headers.lua | 3 +++ test/headerstest.lua | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/headers.lua b/src/headers.lua index f8b8ef8..004ef37 100644 --- a/src/headers.lua +++ b/src/headers.lua @@ -36,6 +36,9 @@ setmetatable(_M.canonic, { -- adds a header with a given canonical capitalization, e.g. for headers -- whose capitalization titlecase(header) would not reproduce correctly function _M.setcanonic(header) + if type(header) ~= "string" then + error("header must be a string", 2) + end _M.canonic[header:lower()] = header end diff --git a/test/headerstest.lua b/test/headerstest.lua index 1387fc7..cbf638f 100644 --- a/test/headerstest.lua +++ b/test/headerstest.lua @@ -103,7 +103,7 @@ local check_canonic = function(lower, expected) if got ~= expected then print("canonic[" .. lower .. "] = " .. tostring(got) .. ", expected " .. expected) - os.exit() + os.exit(1) end end -- cgit v1.2.3-55-g6feb