MCPcopy Index your code
hub / github.com/github-tools/github / _request204or404

Method _request204or404

lib/Requestable.js:210–230  ·  view source on GitHub ↗

* Make a request to an endpoint the returns 204 when true and 404 when false * @param {string} path - the path to request * @param {Object} data - any query parameters for the request * @param {Requestable.callback} cb - the callback that will receive `true` or `false` * @param {meth

(path, data, cb, method = 'GET')

Source from the content-addressed store, hash-verified

208 * @return {Promise} - the promise for the http request
209 */
210 _request204or404(path, data, cb, method = 'GET') {
211 return this._request(method, path, data)
212 .then(function success(response) {
213 if (cb) {
214 cb(null, true, response);
215 }
216 return true;
217 }, function failure(response) {
218 if (response.response.status === 404) {
219 if (cb) {
220 cb(null, false, response);
221 }
222 return false;
223 }
224
225 if (cb) {
226 cb(response);
227 }
228 throw response;
229 });
230 }
231
232 /**
233 * Make a request and fetch all the available data. Github will paginate responses so for queries

Callers 7

isMemberMethod · 0.80
isStarredMethod · 0.80
isManagedRepoMethod · 0.80
manageRepoMethod · 0.80
unmanageRepoMethod · 0.80
deleteTeamMethod · 0.80
isStarredMethod · 0.80

Calls 1

_requestMethod · 0.95

Tested by

no test coverage detected