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

Nested variable expansion doesn't work with dots in the host only #7965

Closed
sparecycles opened this issue Jan 28, 2020 · 4 comments
Closed

Nested variable expansion doesn't work with dots in the host only #7965

sparecycles opened this issue Jan 28, 2020 · 4 comments

Comments

@sparecycles
Copy link

sparecycles commented Jan 28, 2020

Describe the bug
A complex variable expansion with dots does not expand fully when used in the host part of the URL.

E.g. {{a.dotted.{{param}}}} with param=value and a.dotted.value=dotted ends up trying to connect to the domain {{a.dotted.value}} rather than its expansion dotted.

in contrast {{a-hyphenated-{{param}}}} with param=value and a-hyphenated-value=hyphenated ends up trying to connect to the domain hyphenated as expected.

To Reproduce

Try the fails request in this collection:

test.postman_collection.json
{
	"info": {
		"_postman_id": "30bccd1b-8366-4cda-85f5-8e6f3724d1e7",
		"name": "test",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "works",
			"request": {
				"method": "GET",
				"header": [],
				"url": {
					"raw": "{{a-hyphen-{{param}}}}:8000/{{a-hyphen-{{param}}}}/{{a.dotted.{{param}}}}?works={{a-hyphen-{{param}}}}&works-here={{a.dotted.{{param}}}}",
					"host": [
						"{{a-hyphen-{{param}}}}"
					],
					"port": "8000",
					"path": [
						"{{a-hyphen-{{param}}}}",
						"{{a.dotted.{{param}}}}"
					],
					"query": [
						{
							"key": "works",
							"value": "{{a-hyphen-{{param}}}}"
						},
						{
							"key": "works-here",
							"value": "{{a.dotted.{{param}}}}"
						}
					]
				}
			},
			"response": []
		},
		{
			"name": "fails",
			"request": {
				"method": "GET",
				"header": [],
				"url": {
					"raw": "{{a.dotted.{{param}}}}:8000/{{a-hyphen-{{param}}}}/{{a.dotted.{{param}}}}?works={{a-hyphen-{{param}}}}&works-here={{a.dotted.{{param}}}}",
					"host": [
						"{{a",
						"dotted",
						"{{param}}}}"
					],
					"port": "8000",
					"path": [
						"{{a-hyphen-{{param}}}}",
						"{{a.dotted.{{param}}}}"
					],
					"query": [
						{
							"key": "works",
							"value": "{{a-hyphen-{{param}}}}"
						},
						{
							"key": "works-here",
							"value": "{{a.dotted.{{param}}}}"
						}
					]
				}
			},
			"response": []
		}
	],
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"id": "c2370d9a-8816-4cb2-b020-b02727bfe049",
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"id": "309ee429-b671-4424-939e-a5218b59dd36",
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		}
	],
	"variable": [
		{
			"id": "460cd341-dbb2-4fdc-8138-84775b540ff9",
			"key": "a-hyphen-value",
			"value": "hyphenated",
			"type": "string"
		},
		{
			"id": "d268d28d-f671-4e54-bb06-d243009e6ab0",
			"key": "a.dotted.value",
			"value": "dotted",
			"type": "string"
		},
		{
			"id": "4b610089-851c-4d05-99f9-d09b4ede5ea3",
			"key": "param",
			"value": "value",
			"type": "string"
		}
	],
	"protocolProfileBehavior": {}
}

Expected behavior

Variable expansion should work the same everywhere.

Workarounds

  • Use hyphens in complex variables used in the host (as in the works request in the collection)

Screenshots

example

App information

  • Native App
  • Version 7.16.0
  • macOS High Sierra 10.13.6

Additional context

Note that this issue only affects complex variable expansion in the host part of the URL, but not in the scheme, port, path, query, headers, or body! ¯\_(ツ)_/¯

@shamasis
Copy link
Member

shamasis commented Mar 7, 2020

@sparecycles can you check if latest Postman Canary release solves this for you? More details at #8154

@shamasis shamasis added the bug label Mar 7, 2020
@shamasis shamasis moved this from Pending triage to Ready in Runtime Triage and Development Mar 7, 2020
@sparecycles
Copy link
Author

@shamasis it does indeed.

fixed

@codenirvana
Copy link
Member

This is fixed in the latest version of the Postman app (v7.20.0).

@shamasis
Copy link
Member

@sparecycles rarely it happens that I’m happy that a request sending failed!!! This was a fairly maddening piece of bug and I’m glad it’s solved for you.

In production app, do remember to turn on the “Use next generation url processor” setting turned on in order to benefit from the new url parser. 🎉🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants