From 69fda5cf985dbd8d6b5f210cdf15cf9caab44286 Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Fri, 27 May 2016 16:21:31 -0700 Subject: [PATCH] index: de-privatize `fetch` --- lib/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/index.js b/lib/index.js index 6495c1c..fa4b83f 100644 --- a/lib/index.js +++ b/lib/index.js @@ -74,7 +74,7 @@ export default class Now extends EventEmitter { const deployment = await retry(async (bail) => { if (this._debug) console.time('> [debug] /now/create'); - const res = await this._fetch('/now/create', { + const res = await this.fetch('/now/create', { method: 'POST', body: { forceNew, @@ -164,7 +164,7 @@ export default class Now extends EventEmitter { if (this._debug) console.time(`> [debug] /sync #${attempt} ${names.join(' ')}`); const stream = resumer().queue(data).end(); - const res = await this._fetch('/now/sync', { + const res = await this.fetch('/now/sync', { method: 'POST', headers: { 'Content-Type': 'application/octet-stream', @@ -198,7 +198,7 @@ export default class Now extends EventEmitter { const { deployments } = await retry(async (bail) => { if (this._debug) console.time('> [debug] /list'); - const res = await this._fetch('/now/list' + query); + const res = await this.fetch('/now/list' + query); if (this._debug) console.timeEnd('> [debug] /list'); // no retry on 4xx @@ -224,7 +224,7 @@ export default class Now extends EventEmitter { await retry(async (bail) => { if (this._debug) console.time('> [debug] /remove'); - const res = await this._fetch('/now/remove', { + const res = await this.fetch('/now/remove', { method: 'DELETE', body: data }); @@ -277,7 +277,7 @@ export default class Now extends EventEmitter { return this._syncAmount; } - _fetch (_url, opts = {}) { + fetch (_url, opts = {}) { opts.headers = opts.headers || {}; opts.headers.authorization = `Bearer ${this._token}`; return this._agent.fetch(_url, opts);