Skip to content

Allow response headers to contain array of values #1598

@ioquatix

Description

@ioquatix

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions