|
/** |
|
* Have the authenticated user follow this user |
|
* @see https://developer.github.com/v3/users/followers/#follow-a-user |
|
* @param {string} username - the user to follow |
|
* @param {Requestable.callback} [cb] - will receive true if the request succeeds |
|
* @return {Promise} - the promise for the http request |
|
*/ |
|
follow(username, cb) { |
|
return this._request('PUT', `/user/following/${this.__user}`, null, cb); |
|
} |
|
|
|
/** |
|
* Have the currently authenticated user unfollow this user |
|
* @see https://developer.github.com/v3/users/followers/#follow-a-user |
|
* @param {string} username - the user to unfollow |
|
* @param {Requestable.callback} [cb] - receives true if the request succeeds |
|
* @return {Promise} - the promise for the http request |
|
*/ |
|
unfollow(username, cb) { |
|
return this._request('DELETE', `/user/following/${this.__user}`, null, cb); |
|
} |
The username argument in these functions is not used. Instead, these requests attempt to follow or unfollow the authenticated user. Surprisngly, there are no errors when you attempt to follow yourself and the same status code is returned as if you were to follow someone else. However, if you make a request to follow yourself, you won't actually be listed as one of your followers.
github/lib/User.js
Lines 182 to 202 in 90fb78b
The
usernameargument in these functions is not used. Instead, these requests attempt to follow or unfollow the authenticated user. Surprisngly, there are no errors when you attempt to follow yourself and the same status code is returned as if you were to follow someone else. However, if you make a request to follow yourself, you won't actually be listed as one of your followers.