Skip to content

[bug]: keploy import postman treats Postman folders as API requests and fails with URL is empty#4434

Description

@Utkarshpandey0001

馃憖 Is there an existing issue for this?

  • I have searched and didn't find similar issue

馃憤 Current behavior

When I import a Postman collection that contains a folder, keploy import postman incorrectly treats the folder itself as an API request.

For testing, I created a minimal collection.json with this Postman structure:

Users               <-- Postman folder
  List users        <-- actual API request

The actual request has a URL, but the folder Users does not. When I run the import command and answer yes to the capture prompt, Keploy tries to process Users as a request and fails with:

ERROR URL is empty {"testItem": "Users"}
ERROR failed to import Postman collection {"error": "URL is empty"}

Expected behavior:

Keploy should treat Users as a folder only, and should import only the nested request List users.

馃憻 Steps to Replicate

  1. Create a temporary repro folder:
mkdir -p /private/tmp/keploy-postman-var-repro
cd /private/tmp/keploy-postman-var-repro
  1. Create collection.json with a Postman folder named Users and one request inside it:
{
  "info": {
    "_postman_id": "11111111-1111-1111-1111-111111111111",
    "name": "Folder repro",
    "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
  },
  "item": [
    {
      "name": "Users",
      "item": [
        {
          "name": "List users",
          "request": {
            "method": "GET",
            "header": [],
            "url": "https://api.example.test/users"
          },
          "response": []
        }
      ]
    }
  ]
}
  1. Build Keploy from local source into a temporary binary path:
cd (to your local repo path)
mkdir -p /private/tmp/keploy-bin
go build -o /private/tmp/keploy-bin/keploy .
  1. Run the Postman import from the repro folder:
cd /private/tmp/keploy-postman-var-repro
printf 'yes\n' | /private/tmp/keploy-bin/keploy import postman --path collection.json --disable-ansi
  1. See the error:
ERROR URL is empty {"testItem": "Users"}
ERROR failed to import Postman collection {"error": "URL is empty"}

My temporary folder structure during testing was:

/private/tmp/
  keploy-bin/
    keploy
  keploy-postman-var-repro/
    collection.json

馃摐 Logs (if any)

Keploy Postman import error
Some responses are empty. We need to hit the server to record these responses. Is your server running? (yes/no):
ERROR URL is empty {"testItem": "Users"}
ERROR failed to import Postman collection {"error": "URL is empty"}

馃捇 Operating system

macOS

馃Ь System Info (uname -a)

Darwin Utkarshs-MacBook-Air.local 24.1.0 Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:14 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T8103 arm64

馃摝 OS Release Info (cat /etc/os-release)

Not applicable, running on macOS.

馃惓 Docker Info (if applicable)

Not using Docker for this reproduction.

馃П Your Environment

Local machine reproduction.

Repo path:

(to your local repo path)

Temporary binary path:

/private/tmp/keploy-bin/keploy

Temporary repro path:

/private/tmp/keploy-postman-var-repro

馃幉 Version

Built from local main branch. Keploy output shows version: 3-dev.

馃摝 Repository

keploy

馃 What use case were you trying? (optional)

I was trying to import a Postman collection into Keploy tests. The collection has folders, which is common in Postman for grouping API requests.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingkeploy

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions