From a63fa963b7bd01f1b470bea7c5a2ed326ff760e6 Mon Sep 17 00:00:00 2001
From: Thijs Schreijer
-You can obtain the headers namespace if case run-time -modifications are required by running: +If a lowercase field name is not present as a key, +socket.headers.canonic automatically derives a +capitalization by uppercasing the first letter of each +hyphen-separated word (e.g. x-request-id becomes +X-Request-Id), and caches the result for later lookups. +A small set of headers whose canonic capitalization is +irregular (such as ETag, Content-MD5, +MIME-Version and WWW-Authenticate) are kept as +explicit entries in the table and are not affected by this rule. +Because of this, pairs(socket.headers.canonic) only +shows the irregular entries plus any field name already looked +up or added — it is not an exhaustive list of every header +name the library knows how to capitalize. +
+ ++You can register a custom canonic capitalization — for a +header the automatic rule would not reproduce, such as a custom +all-caps acronym — with socket.headers.setcanonic:
-- loads the headers module
-local headers = require("headers")
+local headers = require("socket.headers")
+
+-- register a custom capitalization
+headers.setcanonic("X-Request-ID")
--
cgit v1.2.3-55-g6feb