node-XMLHttpRequest
node-XMLHttpRequest copied to clipboard
getRequestHeader should be case-insensitive
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.
+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.
:+1:
Why not simply use lower-cased values. A lot of libraries (e.g. github's fetch polyfill) normalize into lower-cased header keys.