aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/headers.lua3
-rw-r--r--test/headerstest.lua2
2 files changed, 4 insertions, 1 deletions
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, {
36-- adds a header with a given canonical capitalization, e.g. for headers 36-- adds a header with a given canonical capitalization, e.g. for headers
37-- whose capitalization titlecase(header) would not reproduce correctly 37-- whose capitalization titlecase(header) would not reproduce correctly
38function _M.setcanonic(header) 38function _M.setcanonic(header)
39 if type(header) ~= "string" then
40 error("header must be a string", 2)
41 end
39 _M.canonic[header:lower()] = header 42 _M.canonic[header:lower()] = header
40end 43end
41 44
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)
103 if got ~= expected then 103 if got ~= expected then
104 print("canonic[" .. lower .. "] = " .. tostring(got) .. 104 print("canonic[" .. lower .. "] = " .. tostring(got) ..
105 ", expected " .. expected) 105 ", expected " .. expected)
106 os.exit() 106 os.exit(1)
107 end 107 end
108end 108end
109 109