node-XMLHttpRequest icon indicating copy to clipboard operation
node-XMLHttpRequest copied to clipboard

getRequestHeader should be case-insensitive

Open driverdan opened this issue 13 years ago • 3 comments

Per spec headers should be case-insensitive as should any functions that access them. getRequestHeader currently assumes a case match.

Consider rewriting all response header related code to use a string to store headers instead of an array. A regex can then be used to retrieve headers and ignore case.

driverdan avatar Feb 20 '12 01:02 driverdan

+1. This is particularly painful when you setRequestHeader with "Content-type", while the code checks explicitly for "Content-Type", and ends up overwriting your specified type with the default text/plain.

max99x avatar Apr 18 '13 20:04 max99x

:+1:

eladb avatar Jan 21 '15 17:01 eladb

Why not simply use lower-cased values. A lot of libraries (e.g. github's fetch polyfill) normalize into lower-cased header keys.

dbo avatar May 21 '15 09:05 dbo