No response data in Chrome.
See original GitHub issueHello,
This is a bit of a strange issue to report, but it seems to be coming from vue-resource 1.x.
So basically things were working fine for a while, but I think a recent version of Chrome stopped displaying response data with vue-resource.
Chrome Version 56.0.2924.87 (64-bit)
The strange thing is that: It only occurs immediately following an OPTIONS request. If for instance I make a request with no authorization header it’s fine. But if I make a CORS request with Authorization
header it will fire the OPTIONS request first. I can see the response of that. But the subsequent response does not display.
NOTE: There is only issue with the response displaying. All my code and the plugin otherwise works perfectly fine.
I’m using Laravel and have stripped down the example to bare bones so it’s plain php and the problem persisted. When I did a straight xmlhttp
request:
function loadXMLDoc() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == XMLHttpRequest.DONE ) {
// if (xmlhttp.status == 200) {
console.log(xmlhttp.responseText);
// }
// else if (xmlhttp.status == 400) {
// alert('There was an error 400');
// }
// else {
// // alert('something else other than 200 was returned');
// }
}
};
xmlhttp.open("GET", "https://hs.api.laravel-starter.com/api/v1/auth/user", true);
xmlhttp.setRequestHeader('Authorization', 'Bearer: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2hzLmFwaS5sYXJhdmVsLXN0YXJ0ZXIuY29tL2FwaS92MS9hdXRoL3JlZnJlc2giLCJpYXQiOjE0ODc4NTYyODIsImV4cCI6MTQ4OTExMjAyNywibmJmIjoxNDg3OTAyNDI3LCJqdGkiOiI3cGlrOEp6Q2d1a3hmMnRSIiwic3ViIjoxfQ.WJINr9wxSxkJj5raI8ljEMl_0RUs6ncXcGwFFmaEc84');
xmlhttp.send();
}
loadXMLDoc();
The problem went away. I was doing this in my root app component of Vue. I also tried using axios and the problem also seems to have gone away. So makes me think there is an issue here.
Vue 2.1.10 Vue Router 2.2.0 Vue Resource 1.2.0 & 1.0.3
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:19 (6 by maintainers)
Top GitHub Comments
So seems there is a fix for this to not set the responseType to ‘blob’?
http://stackoverflow.com/questions/42172505/chrome-no-response-data-after-options-request
Not sure if this will affect other things though.
I’ve created a pull request with a fix to this issue. Basically it allows you to set custom responseType in options.
https://github.com/pagekit/vue-resource/pull/584/files