Kong / insomnia

The open-source, cross-platform API client for GraphQL, REST, WebSockets, SSE and gRPC. With Cloud, Local and Git storage.
https://insomnia.rest
Apache License 2.0
34.36k stars 1.94k forks source link

Collections imported from Postman use incorrect syntax for environment variables #6204

Open andreassiegel opened 1 year ago

andreassiegel commented 1 year ago

Expected Behavior

When I import a Postman collection into Insomnia, I would like it to work without any further modifications. Unfortunately, this is not possible since none of the variables can be resolved afterward.

Actual Behavior

Postman uses the syntax {{my-variable}} to reference variables from the environment. This is imported into Insomnia as is but Insomnia would actually require {{ _['my-variable'] }} to correctly reference a variable from an environment in Insomnia.

The imported request:

image

Details about the variable using in the URL:

image

The way Insomnia can use the variable:

image

If I export the new Insomnia collection again, the JSON shows the two different syntax variants:

{
    "_type": "export",
    "__export_format": 4,
    "__export_date": "2023-07-27T05:42:24.205Z",
    "__export_source": "insomnia.desktop.app:v2023.4.0",
    "resources": [
        {
            "_id": "req_d14ba894132946e38504cc06db32ceb0",
            "parentId": "fld_957c215ce3c54ecb956087081a47ecdb",
            "modified": 1690436504823,
            "created": 1690436253238,
            "url": "{{ _['config-base-url'] }}/:applicationName/:profile",
            "name": "Get Default Service Configuration",
            "description": "",
            "method": "GET",
            "body": {},
            "parameters": [],
            "headers": [],
            "authentication": {},
            "metaSortKey": -1690436253238,
            "isPrivate": false,
            "settingStoreCookies": true,
            "settingSendCookies": true,
            "settingDisableRenderRequestBody": false,
            "settingEncodeUrl": true,
            "settingRebuildPath": true,
            "settingFollowRedirects": "global",
            "_type": "request"
        },
...
        {
            "_id": "req_61ae16d74eda4caea60cc69a4e60712c",
            "parentId": "fld_957c215ce3c54ecb956087081a47ecdb",
            "modified": 1690436253238,
            "created": 1690436253238,
            "url": "{{config-base-url}}/:applicationName/:profile/:label",
            "name": "Get Service Configuration with Label",
            "description": "",
            "method": "GET",
            "body": {},
            "parameters": [],
            "headers": [],
            "authentication": {},
            "metaSortKey": -1690436253238,
            "isPrivate": false,
            "settingStoreCookies": true,
            "settingSendCookies": true,
            "settingDisableRenderRequestBody": false,
            "settingEncodeUrl": true,
            "settingRebuildPath": true,
            "settingFollowRedirects": "global",
            "_type": "request"
        },
...
    ]
}

P.S.: Also note how Postman supported path parameters (variables in the path) like :applicationName and :profile which are not understood by Insomnia as such.

Reproduction Steps

  1. On the main screen, click on + Create and select Import
  2. Choose the file of a previously exported Postman collection using environment variables
  3. Click Scan
  4. Click Import on the next screen
  5. Open the collection in the imported workspace

Is there an existing issue for this?

Additional Information

No response

Insomnia Version

2023.4.0

What operating system are you using?

macOS

Operating System Version

Ventura 13.4.1

Installation method

homebrew

Last Known Working Insomnia version

No response

unilogica commented 1 year ago

I'm facing the same issue. I'm also unable to change the values of the variables when I import them from Postman.

jackkav commented 1 year ago

I'm facing the same issue. I'm also unable to change the values of the variables when I import them from Postman.

If you toggle raw template syntax in preference you can manually edit the {{ ... }} interpolation tags