Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generally anything in the 2XX space is considered a successful call. #7

Open
shinjonathan opened this issue Nov 3, 2020 · 1 comment

Comments

@shinjonathan
Copy link
Contributor

if(res.status != 204 || res.headers.status != "204 No Content") throw err;

@KianBadie
Copy link
Contributor

Thank you again @shinjonathan! I think my original intention with that is regarding this issue here. I was calling octokit's paginate function (which basically just aggregates all the paginated data of a given endpoint) for the listContributors endpoint on an empty repository, which returned a TypeError. However, if I called the listContributors function on the empty repo, it seems to return a response with a 204 code. The issue I linked seems to show that this is not intended, as expressed in this comment. So my workaround/mindset was "if I get an error from the paginate function for listContributors, check if using the non paginated version (listContributors in this case) returns the 204 code. If it is the 204 code, it means paginate was called on an empty repo. If not 204, then it is some error I do not know about and I want to propagate it."

Given that explanation, do you think it is justifiable to be on the specific lookout for code 204 like I was doing? Or do you think I should still change something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants