@openfn/language-common 2.3.1 → 2.3.2

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/index.cjs CHANGED
@@ -327,9 +327,11 @@ function encodeRequestBody(body) {
327
327
  throw new Error("Unsupported body type");
328
328
  }
329
329
  async function readResponseBody(response, parseAs) {
330
+ var _a;
331
+ const contentLength = ((_a = response.body) == null ? void 0 : _a.readableLength) ?? 0;
332
+ const contentType = response.headers["content-type"];
330
333
  try {
331
- const contentType = response.headers["content-type"];
332
- if (+response.headers["content-length"] === 0) {
334
+ if (Number.isNaN(contentLength) || contentLength === 0) {
333
335
  return void 0;
334
336
  }
335
337
  switch (parseAs) {
@@ -347,7 +349,7 @@ async function readResponseBody(response, parseAs) {
347
349
  description: "Error parsing the response body",
348
350
  parseAs,
349
351
  contentType: response.headers["content-type"],
350
- bodyLength: +response.headers["content-length"],
352
+ bodyLength: contentLength,
351
353
  error: error.message
352
354
  });
353
355
  }
package/dist/index.js CHANGED
@@ -265,9 +265,11 @@ function encodeRequestBody(body) {
265
265
  throw new Error("Unsupported body type");
266
266
  }
267
267
  async function readResponseBody(response, parseAs) {
268
+ var _a;
269
+ const contentLength = ((_a = response.body) == null ? void 0 : _a.readableLength) ?? 0;
270
+ const contentType = response.headers["content-type"];
268
271
  try {
269
- const contentType = response.headers["content-type"];
270
- if (+response.headers["content-length"] === 0) {
272
+ if (Number.isNaN(contentLength) || contentLength === 0) {
271
273
  return void 0;
272
274
  }
273
275
  switch (parseAs) {
@@ -285,7 +287,7 @@ async function readResponseBody(response, parseAs) {
285
287
  description: "Error parsing the response body",
286
288
  parseAs,
287
289
  contentType: response.headers["content-type"],
288
- bodyLength: +response.headers["content-length"],
290
+ bodyLength: contentLength,
289
291
  error: error.message
290
292
  });
291
293
  }
package/dist/util.cjs CHANGED
@@ -236,9 +236,11 @@ function encodeRequestBody(body) {
236
236
  throw new Error("Unsupported body type");
237
237
  }
238
238
  async function readResponseBody(response, parseAs) {
239
+ var _a;
240
+ const contentLength = ((_a = response.body) == null ? void 0 : _a.readableLength) ?? 0;
241
+ const contentType = response.headers["content-type"];
239
242
  try {
240
- const contentType = response.headers["content-type"];
241
- if (+response.headers["content-length"] === 0) {
243
+ if (Number.isNaN(contentLength) || contentLength === 0) {
242
244
  return void 0;
243
245
  }
244
246
  switch (parseAs) {
@@ -256,7 +258,7 @@ async function readResponseBody(response, parseAs) {
256
258
  description: "Error parsing the response body",
257
259
  parseAs,
258
260
  contentType: response.headers["content-type"],
259
- bodyLength: +response.headers["content-length"],
261
+ bodyLength: contentLength,
260
262
  error: error.message
261
263
  });
262
264
  }
package/dist/util.js CHANGED
@@ -187,9 +187,11 @@ function encodeRequestBody(body) {
187
187
  throw new Error("Unsupported body type");
188
188
  }
189
189
  async function readResponseBody(response, parseAs) {
190
+ var _a;
191
+ const contentLength = ((_a = response.body) == null ? void 0 : _a.readableLength) ?? 0;
192
+ const contentType = response.headers["content-type"];
190
193
  try {
191
- const contentType = response.headers["content-type"];
192
- if (+response.headers["content-length"] === 0) {
194
+ if (Number.isNaN(contentLength) || contentLength === 0) {
193
195
  return void 0;
194
196
  }
195
197
  switch (parseAs) {
@@ -207,7 +209,7 @@ async function readResponseBody(response, parseAs) {
207
209
  description: "Error parsing the response body",
208
210
  parseAs,
209
211
  contentType: response.headers["content-type"],
210
- bodyLength: +response.headers["content-length"],
212
+ bodyLength: contentLength,
211
213
  error: error.message
212
214
  });
213
215
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-common",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "Common Expressions for OpenFn",
5
5
  "homepage": "https://docs.openfn.org",
6
6
  "repository": {
@@ -39,7 +39,7 @@
39
39
  "csvtojson": "^2.0.10",
40
40
  "date-fns": "^2.25.0",
41
41
  "http-status-codes": "^2.3.0",
42
- "jsonpath-plus": "^10.2.0",
42
+ "jsonpath-plus": "^10.3.0",
43
43
  "lodash": "^4.17.21",
44
44
  "undici": "^5.28.5"
45
45
  },