Skip to content

Instantly share code, notes, and snippets.

@sudarsangp
Created September 18, 2017 09:23
Show Gist options
  • Save sudarsangp/645eb33712ecfb3e21a66cfc3ab6d4dd to your computer and use it in GitHub Desktop.
Save sudarsangp/645eb33712ecfb3e21a66cfc3ab6d4dd to your computer and use it in GitHub Desktop.
POSTMAN: parse request parameters
const paramsString = request.url.split('?')[1];
const eachParamArray = paramsString.split('&');
let params = {};
eachParamArray.forEach((param) => {
const key = param.split('=')[0];
const value = param.split('=')[1];
Object.assign(params, {[key]: value});
});
console.log(params); // this is object with request params as key value pairs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment