Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Handle HTTP 204 on a repo having no contributors #93

Merged
merged 2 commits into from Feb 20, 2014

Conversation

Projects
None yet
2 participants
Contributor

suprememoocow commented Feb 20, 2014

When a repository has no contributors (it can happen!) the /repo/x/y/contributors call returns a 204, which Octonode translates into an error, whereas it should be a empty result.

@pksunkara pksunkara commented on an outdated diff Feb 20, 2014

src/octonode/repo.coffee
@@ -76,7 +76,13 @@ 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
+ cb(new Error("Repo contributors error"))
+ else
+ cb null, b, h
@pksunkara

pksunkara Feb 20, 2014

Owner

Make the above 4 lines into a single one?

Contributor

suprememoocow commented Feb 20, 2014

Please excuse my coffeescript. The sum total of all the coffeescript I've written in the world is in the PR's I've sent to this project, so at times it can be a little rough!

@pksunkara pksunkara added a commit that referenced this pull request Feb 20, 2014

@pksunkara pksunkara Merge pull request #93 from troupe/no_contributors
Handle HTTP 204 on a repo having no contributors
adabb3a

@pksunkara pksunkara merged commit adabb3a into pksunkara:master Feb 20, 2014

@suprememoocow suprememoocow deleted the troupe:no_contributors branch Feb 20, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment