Skip to content

Commit

Permalink
Merge pull request #152 from aendrew/147_fix_getSha_write
Browse files Browse the repository at this point in the history
Made returning raw conditional. Fixes #147.
  • Loading branch information
Ændrew Rininsland committed Mar 18, 2015
2 parents f3ca213 + 2d1c754 commit 7fc0ca0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions github.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
}

var xhr = new XMLHttpRequest();
if (!raw) {xhr.dataType = "json";}


xhr.open(method, getURL(), !sync);
if (!sync) {
Expand All @@ -59,7 +59,14 @@
}
};
}
xhr.setRequestHeader('Accept','application/vnd.github.v3.raw+json');

if (!raw) {
xhr.dataType = "json";
xhr.setRequestHeader('Accept','application/vnd.github.v3+json');
} else {
xhr.setRequestHeader('Accept','application/vnd.github.v3.raw+json');
}

xhr.setRequestHeader('Content-Type','application/json;charset=UTF-8');
if ((options.token) || (options.username && options.password)) {
var authorization = options.token ? 'token ' + options.token : 'Basic ' + btoa(options.username + ':' + options.password);
Expand Down

0 comments on commit 7fc0ca0

Please sign in to comment.