Created
January 15, 2019 10:57
-
-
Save prashantagarwal/22b4297f85bbb7b5f7dc079afd396f92 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // I have stored the generated Mock URL as Collection Variable | |
| let snapshotURL = pm.variables.get('snapshotURL'), | |
| /* Create the path that was used in actual request. We will send it along with our Mock endpoint */ | |
| path = pm.request.url.path.join('/'); | |
| /* If request contains any query params then pass those as well to mock endpoint */ | |
| if (pm.request.url.query.count()) { | |
| let params = pm.request.url.query.map((q) => { | |
| return `${q.key}=${q.value}`; | |
| }) | |
| path = `${path}?${params.join('&')}`; | |
| } | |
| // This is the final mock request that we will use. | |
| let snapshotFetchOptions = { | |
| url: `${snapshotURL}/${path}`, | |
| method: pm.request.method | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment