title: Using NodeJS for serving content, but responseType is always ""
body: <p>I'm trying to develop a simple API using Node.js, im using XMLHttpRequest on client and the data is being served well, but I'm not being able to set a Response-Type header to my response.</p>
  
  <p>So the Response-Type on xhr object on client is getting always:
  <code>responseType:""</code>.</p>
  
  <p>Even when I set:</p>
  
  <pre><code>res.writeHead(200, {'content-type':"application/javascript"});
  </code></pre>
  
  <p>It happens to both POST and GET situations.</p>
  
  <p>-
  My server.js:</p>
  
  <pre><code>var https = require('https'),
      options = {
          key : fs.readFileSync('key.pem'),
          cert : fs.readFileSync('cert.pem')
      },
      server = https.createServer(options);
  
  server.on('request', function (req, res) {
     switch(req.method){
         case "GET":
             res.writeHead(200, {
                 'accept': '*/*',
                 'content-type': "application/javascript"
             });
             res.end('console.log("API GET Received")');
             break;
         case "POST":
             res.writeHead(200, {
                 'content-type': "application/javascript"
             });
             req.on("data", function(data){
                 console.log(data.toString("utf8"));
             });
  
             res.end('console.log("API POST received")');
             break;
         case "PUT":
             break;
         case "DELETE":
             break;
      }
      req.on('error', function(err) {console.log(err);});
      return;
  }
  server.listen(443);
  </code></pre>
  
  <p>-
  The XHR object logged on client:</p>
  
  <pre><code>...
  readyState:4
  response:'console.log("API POST received")'
  responseText:'console.log("API POST received")'
  responseType:"" //This should be: "application/javascript"
  ...
  </code></pre>
  
  <p>By the way:</p>
  
  <pre><code>node -v:       v6.5.0
  npm --version: 3.10.6
  </code></pre>
  
  <p>Any Suggestions?</p>
  
  <p>Thanks!</p>