title: Dojo can't make a CORS request. jQuery can
body: <p>I've setup a dojo module to handle my communication:</p>
  
  <pre><code>define(["dojo/request/xhr", "dojo/json"],
    function(xhr, JSON) {
  
    return {
      getJson: function(url) {
        return xhr.get(url, {handleAs:'json', headers: {"X-Requested-With": ""}});
      },
      postJson: function(url, postData) {
        return xhr(url, {
          method: 'POST',
          handleAs: "json",
          data: JSON.stringify(postData),
          headers: {"X-Requested-With": "", "Content-Type":"application/json"}
        })
      },
      getSecure: function(url, token) {
        return xhr.get(url, {handleAs:'json', headers: {"X-AUTH": token, "X-Requested-With": "", "Content-Type":"application/json" }});
      },
      postSecure: function(url, postData, token) {
        return xhr(url, {
          method: 'POST',
          handleAs: 'json',
          data: JSON.stringify(postData),
          headers: {"X-Requested-With": "", "Content-Type":"application/json", "X-AUTH": token}
        });
      }
    };
  
  });
  </code></pre>
  
  <p>While sending a request, OPTIONS fails almost immediately. I tried the request in Postman just to make sure the API was alive and well. Then I got a wild hair and built a quick test in jQuery:</p>
  
  <pre><code>$.ajax({
    url: 'https://someurl.url/auth/get_token',
    type: 'post',
    data: JSON.stringify({username:"user", password:"pass"}),
    contentType: 'application/json',
    dataType: 'json' ,
    xhrFields: {
      withCredentials: false
    },
    success: function(json) {
      console.log(json);
      $.ajax({
        url: 'https://someurl.url/api/service/' + json.results.somevalue,
        type: 'GET',
        headers: { 'X-AUTH': json.results.token },
        contentType: 'application/json; charset=utf-8',
        dataType: 'json' ,
        success: function(json) {
          console.log(json);
  
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
          console.log("error :"+XMLHttpRequest.responseText);
        }
  
  
      });
  
    },
    error: function (XMLHttpRequest, textStatus, errorThrown) {
      console.log("error :"+XMLHttpRequest.responseText);
    }
  </code></pre>
  
  <p>That works just fine. I know that Dojo was having problems a year or so ago with sending the 'X-Requested-width' header, but I've nulled that out and it's not attempting to send it. I'm pulling my hair out as I really don't want to include jQuery as a dependency to my app just for making web requests. Dojo SHOULD be able to do this. Any Dojo people out there have any idea how to make this work?</p>