Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ab0b0f5

Browse files
committed
Raw+JSON and UTF-8 headers, create & delete repo
Partly taken from issue/pull github-tools#59
1 parent 3cb3809 commit ab0b0f5

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

github.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
}
5555
}
5656
};
57-
xhr.setRequestHeader('Accept','application/vnd.github.raw');
58-
xhr.setRequestHeader('Content-Type','application/json');
57+
xhr.setRequestHeader('Accept','application/vnd.github.raw+json');
58+
xhr.setRequestHeader('Content-Type','application/json;charset=UTF-8');
5959
if ((options.token) || (options.username && options.password)) {
6060
xhr.setRequestHeader('Authorization', options.token
6161
? 'token '+ options.token
@@ -222,6 +222,20 @@
222222
_request("DELETE", repoPath + "/git/refs/"+ref, options, cb);
223223
};
224224

225+
// Create a repo
226+
// -------
227+
228+
this.createRepo = function(options, cb) {
229+
_request("POST", "/user/repos", options, cb);
230+
};
231+
232+
// Delete a repo
233+
// --------
234+
235+
this.deleteRepo = function(cb) {
236+
_request("DELETE", repoPath, options, cb);
237+
};
238+
225239
// List all branches of a repository
226240
// -------
227241

0 commit comments

Comments
 (0)