rekwest 2.3.3 → 2.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/helpers.js CHANGED
@@ -199,35 +199,31 @@ const premix = (res, {
199
199
  Object.defineProperties(res, {
200
200
  arrayBuffer: {
201
201
  enumerable: true,
202
- value: async function () {
202
+ value: function () {
203
203
  parse &&= false;
204
- const {
204
+ return this.body().then(({
205
205
  buffer,
206
206
  byteLength,
207
207
  byteOffset
208
- } = await this.body();
209
- return buffer.slice(byteOffset, byteOffset + byteLength);
208
+ }) => buffer.slice(byteOffset, byteOffset + byteLength));
210
209
  }
211
210
  },
212
211
  blob: {
213
212
  enumerable: true,
214
- value: async function () {
215
- const val = await this.arrayBuffer();
216
- return new _buffer.Blob([val]);
213
+ value: function () {
214
+ return this.arrayBuffer().then(res => new _buffer.Blob([res]));
217
215
  }
218
216
  },
219
217
  json: {
220
218
  enumerable: true,
221
- value: async function () {
222
- const val = await this.text();
223
- return JSON.parse(val);
219
+ value: function () {
220
+ return this.text().then(res => JSON.parse(res));
224
221
  }
225
222
  },
226
223
  text: {
227
224
  enumerable: true,
228
- value: async function () {
229
- const val = await this.blob().then(blob => blob.text());
230
- return val.toString();
225
+ value: function () {
226
+ return this.blob().then(blob => blob.text());
231
227
  }
232
228
  }
233
229
  });
package/package.json CHANGED
@@ -59,5 +59,5 @@
59
59
  "test": "mocha --exit --recursive",
60
60
  "test:cover": "c8 --include=src --reporter=lcov --reporter=text npm test"
61
61
  },
62
- "version": "2.3.3"
62
+ "version": "2.3.4"
63
63
  }
package/src/helpers.mjs CHANGED
@@ -182,35 +182,31 @@ export const premix = (res, { digest = false, parse = false } = {}) => {
182
182
  Object.defineProperties(res, {
183
183
  arrayBuffer: {
184
184
  enumerable: true,
185
- value: async function () {
185
+ value: function () {
186
186
  parse &&= false;
187
- const { buffer, byteLength, byteOffset } = await this.body();
188
187
 
189
- return buffer.slice(byteOffset, byteOffset + byteLength);
188
+ return this.body().then(({ buffer, byteLength, byteOffset }) => buffer.slice(
189
+ byteOffset,
190
+ byteOffset + byteLength,
191
+ ));
190
192
  },
191
193
  },
192
194
  blob: {
193
195
  enumerable: true,
194
- value: async function () {
195
- const val = await this.arrayBuffer();
196
-
197
- return new Blob([val]);
196
+ value: function () {
197
+ return this.arrayBuffer().then((res) => new Blob([res]));
198
198
  },
199
199
  },
200
200
  json: {
201
201
  enumerable: true,
202
- value: async function () {
203
- const val = await this.text();
204
-
205
- return JSON.parse(val);
202
+ value: function () {
203
+ return this.text().then((res) => JSON.parse(res));
206
204
  },
207
205
  },
208
206
  text: {
209
207
  enumerable: true,
210
- value: async function () {
211
- const val = await this.blob().then((blob) => blob.text());
212
-
213
- return val.toString();
208
+ value: function () {
209
+ return this.blob().then((blob) => blob.text());
214
210
  },
215
211
  },
216
212
  });