Skip to content

Commit 517afe2

Browse files
fix: fetchJson status is 0 on file protocol
1 parent f81f94c commit 517afe2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/helpers/fetchJson.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ export default (file) => {
2222
var xhr = new XMLHttpRequest()
2323
xhr.onreadystatechange = function() {
2424
if (xhr.readyState == XMLHttpRequest.DONE) {
25-
if (xhr.status === 200) resolve(JSON.parse(xhr.responseText))
25+
// file protocol returns 0
26+
// http(s) protocol returns 200
27+
if (xhr.status === 0 || xhr.status === 200) resolve(JSON.parse(xhr.responseText))
2628
else reject(xhr.statusText)
2729
}
2830
}

0 commit comments

Comments
 (0)