@openfn/language-http 5.0.4 → 5.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/index.cjs CHANGED
@@ -256,6 +256,8 @@ function handleResponse(state, response) {
256
256
  response.status,
257
257
  "\u2713"
258
258
  );
259
+ const { method, path, host, protocol, _headers } = response.request;
260
+ response.request = { method, path, host, protocol, _headers };
259
261
  const compatibleResp = {
260
262
  ...response,
261
263
  httpStatus: response.status,
@@ -340,7 +342,8 @@ function del(path, params, callback) {
340
342
  }
341
343
  function parseXML(body, script) {
342
344
  return (state) => {
343
- const $ = import_cheerio.default.load(body);
345
+ const resolvedBody = (0, import_language_common.expandReferences)(body)(state);
346
+ const $ = import_cheerio.default.load(resolvedBody);
344
347
  (0, import_cheerio_tableparser.default)($);
345
348
  if (script) {
346
349
  const result = script($);
@@ -351,7 +354,7 @@ function parseXML(body, script) {
351
354
  return (0, import_language_common.composeNextState)(state, { body: result });
352
355
  }
353
356
  } else {
354
- return (0, import_language_common.composeNextState)(state, { body });
357
+ return (0, import_language_common.composeNextState)(state, { body: resolvedBody });
355
358
  }
356
359
  };
357
360
  }
package/dist/index.js CHANGED
@@ -228,6 +228,8 @@ function handleResponse(state, response) {
228
228
  response.status,
229
229
  "\u2713"
230
230
  );
231
+ const { method, path, host, protocol, _headers } = response.request;
232
+ response.request = { method, path, host, protocol, _headers };
231
233
  const compatibleResp = {
232
234
  ...response,
233
235
  httpStatus: response.status,
@@ -312,7 +314,8 @@ function del(path, params, callback) {
312
314
  }
313
315
  function parseXML(body, script) {
314
316
  return (state) => {
315
- const $ = cheerio.load(body);
317
+ const resolvedBody = expandReferences(body)(state);
318
+ const $ = cheerio.load(resolvedBody);
316
319
  cheerioTableparser($);
317
320
  if (script) {
318
321
  const result = script($);
@@ -323,7 +326,7 @@ function parseXML(body, script) {
323
326
  return composeNextState(state, { body: result });
324
327
  }
325
328
  } else {
326
- return composeNextState(state, { body });
329
+ return composeNextState(state, { body: resolvedBody });
327
330
  }
328
331
  };
329
332
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-http",
3
- "version": "5.0.4",
3
+ "version": "5.1.1",
4
4
  "description": "An HTTP request language package for use with Open Function",
5
5
  "homepage": "https://docs.openfn.org",
6
6
  "repository": {