Skip to content

Instantly share code, notes, and snippets.

View rproman's full-sized avatar
🎯
Studying

Randy Roman rproman

🎯
Studying
View GitHub Profile
@rproman
rproman / Postman - Persist Environment Variables.js
Last active July 1, 2022 19:51
Programmatically persist the current values to initial values of environment variables.
let headers = {'X-Api-Key' : ''};
headers[`X-Api-Key`] = String(pm.variables.get("postman_api_key"));
// Note: Update the environment UID if no longer sync
const postman_api_url = "https://api.getpostman.com/environments/" + pm.environment.get("uid");
let requestOptions = {
url: postman_api_url,
method: 'GET',
header: headers
@rproman
rproman / Postman sendRequest.md
Last active February 16, 2022 13:06 — forked from gghughunishvili/example.md
Postman pm.sendRequest example

To send a request via the sandbox, you can use pm.sendRequest.

pm.test("Status code is 200", function () {
    pm.sendRequest('https://postman-echo.com/get', function (err, res) {
        pm.expect(err).to.not.be.ok;
        pm.expect(res).to.have.property('code', 200);
        pm.expect(res).to.have.property('status', 'OK');
    });
});
// generating random data
var randomData = Math.random();
// getting Auth tokens from other Auth services
pm.sendRequest({
url:"https://postman-echo.com/basic-auth",
method: "GET",
header: {
'Authorization': 'Basic ' + btoa('postman:password')
}
@rproman
rproman / cheerioExamples.js
Created January 29, 2022 06:18 — forked from odevodyssey/cheerioExamples.js
Examples of Cheerio.js methods and their usage
const cheerio = require('cheerio')
const responseBody = "<?xml version='1.0' encoding='us-ascii'?> \
<!-- A SAMPLE set of slides --> \
<soap-env:envelope> \
<soap-env:header> \
<wsse:security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">Assertion Here</wsse:security> \
</soap-env:header> \
<soap-env:body> \
<slideshow \