Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Me.prototype.deleteKey return "TypeError" #228

Open
davideasaf opened this issue Feb 19, 2016 · 0 comments
Open

Me.prototype.deleteKey return "TypeError" #228

davideasaf opened this issue Feb 19, 2016 · 0 comments

Comments

@davideasaf
Copy link

file: octonode/lib/octonode/me.js

Me.prototype.deleteKey = function(id, cb) { return this.client.del("/api/v3/user/keys/" + id, {}, function(err, s, b, h) { if (err) { return cb(err); } if (s !== 204) { return cb(new Error("User deleteKey error")); } else { return cb(null); } }); };

Using: Delete a public key (DELETE /user/keys/1)

When you call the function ghme.keys(1);

  • The docs do not mention a callback, but without a callback, the function always returns

TypeError: undefined is not a function

  • TypeError returns because the "Me.prototype.deleteKey" function is expecting cb to exist.
  • So why not just add a cb? -- if you add a callback to the .keys(id, cb) function, it will return the key information rather than delete it. as it says in "Get a single public key' part of the documentation

Unfortunately whenever a user tries to delete an SSH Public key via octonode, TyperError will always persist.

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

No branches or pull requests

1 participant