* 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')
| 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 |
no test coverage detected