Bug Tracker

Changes between Initial Version and Version 4 of Ticket #12698


Ignore:
Timestamp:
Feb 14, 2013, 11:22:29 AM (9 years ago)
Author:
jaubourg
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #12698

    • Property Status changed from new to closed
    • Property Resolution changed from to notabug
  • Ticket #12698 – Description

    initial v4  
    11This code generates a proper CORS preflight request due to the setting of the Authorization header:
    22
    3 (function() { x = new XMLHttpRequest(); x.open('POST','https://' + document.domain,false); x.onreadystatechange = function() { if(x.readyState === 4) console.info(x.responseText); }; x.setRequestHeader('Authorization', "test"); x.send(''); })();
     3{{{#!js
     4(function() {
     5  x = new XMLHttpRequest();
     6  x.open('POST','https://' + document.domain,false);
     7  x.onreadystatechange = function() {
     8    if( x.readyState === 4 ) {
     9      console.info(x.responseText);
     10    }
     11  };
     12  x.setRequestHeader('Authorization', "test");
     13  x.send('');
     14})();
     15}}}
    416
    517This code generates a broken CORS preflight request (at least in Chrome):
    618
    7 (function() { $.ajax({ url: 'https://' + document.domain, method: 'POST', headers: { Authorization: 'test' }, success: function(text) { console.info(text); } }); })();
     19{{{#!js
     20(function() {
     21  $.ajax({
     22    url: 'https://' + document.domain,
     23    method: 'POST',
     24    headers: {
     25      Authorization: 'test'
     26    },
     27    success: function(text) {
     28      console.info(text);
     29    }
     30  });
     31})();
     32}}}
    833
    934I believe this may be a bug