Skip to content

Instantly share code, notes, and snippets.

@giig982
Forked from arafathusayn/parse-xml.js
Created November 18, 2022 16:48
Show Gist options
  • Select an option

  • Save giig982/2096f7f105e8bd14276f81695f6be704 to your computer and use it in GitHub Desktop.

Select an option

Save giig982/2096f7f105e8bd14276f81695f6be704 to your computer and use it in GitHub Desktop.
Postman Test Script - Parse XML API response & set environment variables from the parsed data
var parseString = require("xml2js").parseString;
var xml = pm.response.text();
parseString(xml, (err, data) => {
if (err) throw err;
// traverse and set env variable
pm.environment.set("ENV_NAME_HERE", data.whatever);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment