Created
September 18, 2017 09:23
-
-
Save sudarsangp/645eb33712ecfb3e21a66cfc3ab6d4dd to your computer and use it in GitHub Desktop.
POSTMAN: parse request parameters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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