JSFiddle - React, Tailwind, and code Playground
HTML
<script src="//cdnjs.cloudflare.com/ajax/libs/vue/2.1.10/vue.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/vue-resource/1.2.0/vue-resource.min.js"></script>
Hello,
<br/><br/>
<ul>
<li>Make sure the OPTIONS request is fired off to see the issue</li>
<li>If you click the button twice in a row, you will see OPTIONS once and then two regular request, the first will NOT show response the second will.</li>
</ul>
<button onclick="testNative()">Test Native</button>
<button onclick="testVueResource()">Test Vue Resource</button>
<script>
function testVueResource() {
Vue.http.get('https://api-demo.websanova.com/api/v1/auth/user', {
headers: {
Authorization: 'Bearer: dXNlcjpwYXNzd29yZA=='
}
});
}
function testNative() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == XMLHttpRequest.DONE ) {
console.log(xmlhttp.responseText);
}
};
xmlhttp.open("GET", "https://api-demo.websanova.com/api/v1/auth/user", true);
xmlhttp.setRequestHeader('Authorization', 'Bearer: dXNlcjpwYXNzd29yZA==');
xmlhttp.send();
}
</script>