mjwwit / node-XMLHttpRequest

XMLHttpRequest for node.js
http://thedanexperiment.com/2009/10/04/emulating-xmlhttprequest-in-node-js/
MIT License
15 stars 24 forks source link

Case-insensitive check for content type before setting it #18

Closed YarnSaw closed 1 month ago

YarnSaw commented 1 month ago

Updated tests/test-headers.js to test for the case this PR addresses.

If the following conditions were met it would result in the content-type header always being "text/plain;charset=UTF-8":

I encountered it when sending a POST request with xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');, then was surprised by the server receiving the content-type as text/plain.