Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path variable in file name does not work #2

Open
vernig opened this issue Jan 8, 2020 · 1 comment
Open

Path variable in file name does not work #2

vernig opened this issue Jan 8, 2020 · 1 comment
Assignees

Comments

@vernig
Copy link
Owner

vernig commented Jan 8, 2020

When the path variable is part of a file name, the conversion is not possible.

For example, the path for application API is
/2010-04-01/Accounts/{AccountSid}/Applications/{Sid}.json

When converted to Postman request this become:
/2010-04-01/Accounts/:AccountSid/Applications/:Sid.json

And postman detect the path variable as :Sid.json, which is a problem since the only variable part in the url is the {Sid}.

@vernig
Copy link
Owner Author

vernig commented Feb 17, 2020

The current solution is to use a script pre-fetch that check if the Sid path parameters ends with .json. If not, add it.

The script can be added using the following event to the request:

	"event": [
		{
			"listen": "prerequest",
			"script": {
				"exec": [
					"var pathVarSid = pm.request.url.variables.get(\"Sid.json\")",
					"if (!pathVarSid.endsWith(\".json\")) {",
					"    pm.request.url.variables.upsert({key:\"Sid.json\", value: pathVarSid + \".json\"})",
					"}"
				],
				"type": "text/javascript"
			}
		}
	],

@vernig vernig self-assigned this Feb 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant