Skip to content

Instantly share code, notes, and snippets.

@jmhungdev
Last active November 20, 2022 06:28
Show Gist options
  • Save jmhungdev/57d463e823f9251c347f294f357b5827 to your computer and use it in GitHub Desktop.
Save jmhungdev/57d463e823f9251c347f294f357b5827 to your computer and use it in GitHub Desktop.
Postman Scripting
// load html reponse in cheerio and retrieve the text of first h2 tag
const $ = cheerio.load(pm.response.text());
let latestDate = $("h2").first().text()
const requrl = `https://postman-echo.com/get?date=${latestDate}`
// send async request with callback
pm.sendRequest(requrl, function (err, response) {
console.log(response.json());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment