Merge pull request #130 from clintongormley/master

Add a "raw" header to the AJAX request when ?load_from points to GitHub API
This commit is contained in:
Clinton Gormley 2014-03-11 11:18:00 +01:00
commit 81d07e0eb2

View file

@ -121,9 +121,13 @@ define([
input.autoIndent();
}
}
else if (/^https?:\/\//.exec(sourceLocation)) {
$.get(sourceLocation, null, function (data) {
resetToValues(null, data);
else if (/^https?:\/\//.test(sourceLocation)) {
var loadFrom = { url: sourceLocation , dataType: "text" };
if (/https?:\/\/api.github.com/.test(sourceLocation)) {
loadFrom.headers = { Accept: "application/vnd.github.v3.raw" };
}
$.ajax(loadFrom).done( function (data) {
resetToValues(defaultHost, data);
input.highlightCurrentRequestAndUpdateActionBar();
input.updateActionsBar();
});
@ -131,7 +135,7 @@ define([
else if (previousSaveState) {
resetToValues(previousSaveState.server);
} else {
resetToValues(defaultHost)
resetToValues(defaultHost);
}
}());