A while ago I discussed with @tenderlove - we currently use \n characters to separate multiple headers. e.g.
{"set-cookie" => "foo=x\nbar=y"}
Internally HeaderHash uses an Array I believe, e.g. something like:
{"set-cookie" => ["foo=x", "bar=y"]}
Personally I like this formulation better, it's more efficient for the server implementation and it's easier from the user POV to deal with too. It seems like less of a hack, and it should minimise
So, I vote to deprecate/remove the "\n" representation and prefer the Array representation.
The only limitation is going to be if people start using it everywhere, e.g..
{"content-type" => ["text/html"]}
There are different solutions to this problem: e.g., we could define only certain headers can work like this (notably set-cookie would make sense) or we could mark certain headers as NOT being allowed to be an array (e.g. content-length).
(Epic #1593)
A while ago I discussed with @tenderlove - we currently use
\ncharacters to separate multiple headers. e.g.Internally
HeaderHashuses an Array I believe, e.g. something like:Personally I like this formulation better, it's more efficient for the server implementation and it's easier from the user POV to deal with too. It seems like less of a hack, and it should minimise
So, I vote to deprecate/remove the "\n" representation and prefer the Array representation.
The only limitation is going to be if people start using it everywhere, e.g..
There are different solutions to this problem: e.g., we could define only certain headers can work like this (notably
set-cookiewould make sense) or we could mark certain headers as NOT being allowed to be an array (e.g.content-length).(Epic #1593)