Permalink
Browse files

Merge pull request #93 from troupe/no_contributors

Handle HTTP 204 on a repo having no contributors
  • Loading branch information...
2 parents 70bb1f0 + 608a761 commit adabb3aafc173fbfa5955a776609f750490ad4c9 @pksunkara committed Feb 20, 2014
Showing with 6 additions and 2 deletions.
  1. +3 −1 lib/octonode/repo.js
  2. +3 −1 src/octonode/repo.coffee
View
4 lib/octonode/repo.js
@@ -119,7 +119,9 @@
if (err) {
return cb(err);
}
- if (s !== 200) {
+ if (s === 204) {
+ return cb(null, [], h);
+ } else if (s !== 200) {
return cb(new Error("Repo contributors error"));
} else {
return cb(null, b, h);
View
4 src/octonode/repo.coffee
@@ -76,7 +76,9 @@ class Repo
contributors: (cb) ->
@client.get "/repos/#{@name}/contributors", (err, s, b, h) ->
return cb(err) if err
- if s isnt 200 then cb(new Error("Repo contributors error")) else cb null, b, h
+ if s is 204
+ cb null, [], h
+ else if s isnt 200 then cb(new Error("Repo contributors error")) else cb null, b, h
# Get the teams for a repository
# '/repos/pksunkara/hub/teams' GET

0 comments on commit adabb3a

Please sign in to comment.