outmoded / discuss

The "mailing list"
99 stars 9 forks source link

The header of the response cannot be set to uppercase? #808

Closed yi-huan closed 5 years ago

yi-huan commented 5 years ago

I use h to set the header in the handler,eg.

handler: (req, h) => {
        return h.response()
            .code(204)
            .header('Content-Date', new Date().getTime());
}

But the header obtained by the browser is always content-date

I found in the file(@hapi/hapi/lib/response.js line 142) code that the header has been converted to lowercase. Can you add an option (for example, keepUppercase) to keep uppercase, just like append, separator, and override?

I know that the specification is not case sensitive, but there are always individual programs that make a difference.

hueniverse commented 5 years ago

No, because it makes it much more costly later to check if a header is already set.