wreq-js 2.0.1 → 2.1.1

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/wreq-js.cjs CHANGED
@@ -42,6 +42,7 @@ module.exports = __toCommonJS(wreq_js_exports);
42
42
  var import_node_crypto = require("crypto");
43
43
  var import_node_http = require("http");
44
44
  var import_node_module = require("module");
45
+ var import_node_stream = require("stream");
45
46
  var import_web = require("stream/web");
46
47
 
47
48
  // src/types.ts
@@ -127,7 +128,7 @@ var bodyHandleFinalizer = typeof FinalizationRegistry === "function" ? new Final
127
128
  }) : void 0;
128
129
  var DEFAULT_BROWSER = "chrome_142";
129
130
  var DEFAULT_OS = "macos";
130
- var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
131
+ var DEFAULT_REQUEST_TIMEOUT_MS = 3e5;
131
132
  var SUPPORTED_OSES = ["windows", "macos", "linux", "android", "ios"];
132
133
  var UTF8_DECODER = new TextDecoder("utf-8");
133
134
  var ephemeralIdCounter = 0;
@@ -593,6 +594,15 @@ var Response = class _Response {
593
594
  );
594
595
  return response.formData();
595
596
  }
597
+ readable() {
598
+ this.assertBodyAvailable();
599
+ this.bodyUsed = true;
600
+ const stream = this.body;
601
+ if (stream === null) {
602
+ return import_node_stream.Readable.from([]);
603
+ }
604
+ return import_node_stream.Readable.fromWeb(stream);
605
+ }
596
606
  clone() {
597
607
  if (this.bodyUsed) {
598
608
  throw new TypeError("Cannot clone a Response whose body is already used");
@@ -729,6 +739,22 @@ var Session = class {
729
739
  throw new RequestError(String(error));
730
740
  }
731
741
  }
742
+ getCookies(url) {
743
+ this.ensureActive();
744
+ try {
745
+ return nativeBinding.getCookies(this.id, String(url));
746
+ } catch (error) {
747
+ throw new RequestError(String(error));
748
+ }
749
+ }
750
+ setCookie(name, value, url) {
751
+ this.ensureActive();
752
+ try {
753
+ nativeBinding.setCookie(this.id, name, value, String(url));
754
+ } catch (error) {
755
+ throw new RequestError(String(error));
756
+ }
757
+ }
732
758
  async websocket(urlOrOptions, options) {
733
759
  this.ensureActive();
734
760
  const normalized = normalizeSessionWebSocketArgs(urlOrOptions, options);
@@ -1210,6 +1236,9 @@ async function fetch(input, init) {
1210
1236
  if (config.disableDefaultHeaders !== void 0) {
1211
1237
  requestOptions.disableDefaultHeaders = config.disableDefaultHeaders;
1212
1238
  }
1239
+ if (config.compress !== void 0) {
1240
+ requestOptions.compress = config.compress;
1241
+ }
1213
1242
  if (headerTuples && headerTuples.length > 0) {
1214
1243
  requestOptions.headers = headerTuples;
1215
1244
  }