ruby on rails - Github API -- request for diff in repository with 1 commit 404s -


i'm trying allow users of app pull git diffs repositories using api. it's working great, except 1 weird case feels bug.

basically, if repo has more 1 commit, works smoothly. however, if there's 1 initial commit, api returns 404 error, brings down view on page. weird, because can view "diffs", or @ least files changed in recent (first) commit, on github page.

moreover, can fetch diff in format (not ideal) if don't specify format accept.

take, example, friend's repo (this using rails's restclient instead of curl). in repo, has 1 commit, 404s:

# replaced fake values (per request) symbols. don't feel comfortable sharing gh info without asking. restclient.get("https://api.github.com/repos/:owner/:repo/commits/:sha", accept: 'application/vnd.github.diff') 

but (without accept) returns commit, not in diff format:

restclient.get("https://api.github.com/repos/:ownder/:repo/commits/:sha") 

if pull diffs other repos of hers more 1 commit, using

restclient.get("https://api.github.com/repos/:owner/:repo/commits/:sha", accept: 'application/vnd.github.diff')  

works great. doing wrong? what's this?


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -