Skip to content

Commit 2d1c754

Browse files
author
Ændrew Rininsland
committed
Made returning raw conditional. Fixes #147.
1 parent ffd7226 commit 2d1c754

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

github.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
}
4646

4747
var xhr = new XMLHttpRequest();
48-
if (!raw) {xhr.dataType = "json";}
48+
4949

5050
xhr.open(method, getURL(), !sync);
5151
if (!sync) {
@@ -59,7 +59,14 @@
5959
}
6060
};
6161
}
62-
xhr.setRequestHeader('Accept','application/vnd.github.v3.raw+json');
62+
63+
if (!raw) {
64+
xhr.dataType = "json";
65+
xhr.setRequestHeader('Accept','application/vnd.github.v3+json');
66+
} else {
67+
xhr.setRequestHeader('Accept','application/vnd.github.v3.raw+json');
68+
}
69+
6370
xhr.setRequestHeader('Content-Type','application/json;charset=UTF-8');
6471
if ((options.token) || (options.username && options.password)) {
6572
var authorization = options.token ? 'token ' + options.token : 'Basic ' + btoa(options.username + ':' + options.password);

0 commit comments

Comments
 (0)