Skip to content

fix: 3014 - Postman import ignores API Key "in" placement setting and defaults to header - #7968

Merged
bijin-bruno merged 5 commits into
usebruno:mainfrom
sharan-bruno:fix/postman_import_ignores_api_key_in_placement_setting_and_defaults_to_header
May 13, 2026
Merged

bijin-bruno merged 5 commits into
usebruno:mainfrom
sharan-bruno:fix/postman_import_ignores_api_key_in_placement_setting_and_defaults_to_header

Conversation

@sharan-bruno

@sharan-bruno sharan-bruno commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

Description

Postman import ignores API Key "in" placement setting and defaults to header
Jira link - https://usebruno.atlassian.net/browse/BRU-3014

Postman's API Key auth supports two placements via the in field ("header" or "query"), but Bruno's Postman importer was ignoring that field entirely and hard-coding the placement to "header". As a result, any Postman collection that authenticated by sending the API key as a query parameter would import incorrectly — the key/value were preserved, but the placement silently flipped to header, breaking the request. The fix is in packages/bruno-converters/src/postman/postman-to-bruno.js: when processing APIKEY auth, the converter now reads authValues.in and maps "query" to Bruno's "queryparams" placement, falling back to "header" for "header", missing, or unknown values (which preserves the previous default for collections that don't specify in). Two Playwright tests were added under tests/import/postman/ covering both placements end-to-end — importing a fixture collection, opening the imported request, and asserting that the Auth tab's placement dropdown reflects the original Postman setting.

Before:
image

After:
image

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

Summary by CodeRabbit

  • Bug Fixes

    • Postman collection import now preserves API key placement — imports API keys as query params or headers according to the source collection (no longer always headers).
  • Tests

    • Added end-to-end and unit tests validating Postman API key import and that the Auth UI shows correct placement after import.
  • Chores

    • Added test-friendly attributes and updated locators for import flows, modals, and API key placement UI to improve UI test reliability.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b93fd0bc-b93c-42b1-93ba-c1c316a34515

📥 Commits

Reviewing files that changed from the base of the PR and between 1bf9b9a and 1a53ee1.

📒 Files selected for processing (3)
  • packages/bruno-app/src/components/Modal/index.js
  • packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js
  • tests/utils/page/locators.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/utils/page/locators.ts

Walkthrough

Postman API key auth "in" location now maps to Bruno's request placement during import: 'query' → queryparams, otherwise header. Added unit tests, e2e fixtures/tests, Playwright locators, and small UI testids and modal wiring to support assertions.

Changes

API Key Placement Import

Layer / File(s) Summary
Converter Logic
packages/bruno-converters/src/postman/postman-to-bruno.js
API key placement derived from Postman's authValues.in field: 'query' maps to 'queryparams', otherwise 'header'.
Unit tests (placement mapping)
packages/bruno-converters/tests/postman/postman-to-bruno/request-auth.spec.js
Jest tests assert mapping for in=query, in=header, and missing in defaulting to header.
Test Fixtures
tests/import/postman/fixtures/postman-import-apikey-header-collection.json, tests/import/postman/fixtures/postman-import-apikey-query-collection.json
Two Postman v2.1 collection fixtures: header-based and query-based API key auth, each with a single GET request to https://api.com/users.
Test locators, UI testids & modal wiring
tests/utils/page/locators.ts, packages/bruno-app/src/components/RequestPane/Auth/ApiKeyAuth/index.js, packages/bruno-app/src/components/Sidebar/ImportCollection/index.js, packages/bruno-app/src/components/Modal/index.js, packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js
Added request pane/body editor locators and auth placement selector/label locators; import helpers for parsing error, browse link, and import button; data-testid attributes for API key placement label/selector and import error; forwarded dataTestId through Modal so the submit button gets a stable ${dataTestId}-submit-btn.
Header Placement Test
tests/import/postman/import-apikey-header-collection.spec.ts
Playwright/Electron test automates import, verifies collection/request in sidebar, opens request Auth tab, asserts placement shows "Header".
Query Placement Test
tests/import/postman/import-apikey-query-collection.spec.ts
Playwright/Electron test automates import, validates import UI states, verifies collection/request presence, switches to Auth tab, asserts placement label reads "Query Params".

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • usebruno/bruno#7646: Modifies processAuth APIKEY handling and related auth normalization in the same converter path.

Suggested reviewers

  • lohit-bruno
  • naman-bruno
  • helloanoop
  • bijin-bruno

Poem

🔑 Keys find their final place,
From Postman fields to Bruno's space,
Fixtures, tests, and locators hum,
Import flows click, assertions come,
Small change, test green — ship with grace.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main fix: Postman import now respects the API Key 'in' placement setting instead of defaulting to header.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
tests/import/postman/import-apikey-query-collection.spec.ts (1)

23-23: 💤 Low value

Consider organizing fixtures using collection directory structure.

Same observation as the header test: the fixture path uses fixtures/postman-import-apikey-query-collection.json directly. Consider organizing fixtures into subdirectories as noted in the header test review.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/import/postman/import-apikey-query-collection.spec.ts` at line 23, The
test uses a flat fixture path stored in the variable postmanFile; move the JSON
into a postman-specific subdirectory (e.g., fixtures/postman/ or
fixtures/postman/collections/) and update the postmanFile assignment to
reference the new location (update the path.resolve call that constructs
postmanFile). Ensure the new directory name follows the same convention used by
other tests (matching the header test refactor) and update any other tests that
reference this fixture variable if necessary.
tests/import/postman/import-apikey-header-collection.spec.ts (1)

23-23: 💤 Low value

Consider organizing fixtures using collection directory structure.

The fixture path uses fixtures/postman-import-apikey-header-collection.json directly in the fixtures folder. Based on learnings from PR 7449, fixtures should be organized as fixtures/collection/ (singular) when there's a single collection.

Consider restructuring to:

tests/import/postman/fixtures/
├── apikey-header-collection/
│   └── postman-import-apikey-header-collection.json
└── apikey-query-collection/
    └── postman-import-apikey-query-collection.json

Or if these fixtures are minimal and test-specific:

tests/import/postman/fixtures/
└── collections/
    ├── postman-import-apikey-header-collection.json
    └── postman-import-apikey-query-collection.json

Based on learnings, fixtures are nested inside the fixtures folder.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/import/postman/import-apikey-header-collection.spec.ts` at line 23, The
test uses the postmanFile constant in import-apikey-header-collection.spec.ts
pointing directly to fixtures/postman-import-apikey-header-collection.json; move
this fixture into a nested fixtures directory (either
fixtures/apikey-header-collection/postman-import-apikey-header-collection.json
or fixtures/collections/postman-import-apikey-header-collection.json) and update
the postmanFile path resolution in the test (the postmanFile variable
assignment) to reference the new nested folder; repeat the same restructure and
path updates for the apikey-query fixture so both tests follow the
fixtures/collection nesting convention.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/import/postman/import-apikey-header-collection.spec.ts`:
- Line 23: The test uses the postmanFile constant in
import-apikey-header-collection.spec.ts pointing directly to
fixtures/postman-import-apikey-header-collection.json; move this fixture into a
nested fixtures directory (either
fixtures/apikey-header-collection/postman-import-apikey-header-collection.json
or fixtures/collections/postman-import-apikey-header-collection.json) and update
the postmanFile path resolution in the test (the postmanFile variable
assignment) to reference the new nested folder; repeat the same restructure and
path updates for the apikey-query fixture so both tests follow the
fixtures/collection nesting convention.

In `@tests/import/postman/import-apikey-query-collection.spec.ts`:
- Line 23: The test uses a flat fixture path stored in the variable postmanFile;
move the JSON into a postman-specific subdirectory (e.g., fixtures/postman/ or
fixtures/postman/collections/) and update the postmanFile assignment to
reference the new location (update the path.resolve call that constructs
postmanFile). Ensure the new directory name follows the same convention used by
other tests (matching the header test refactor) and update any other tests that
reference this fixture variable if necessary.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 972343e7-7762-43de-b281-296a0d0d6beb

📥 Commits

Reviewing files that changed from the base of the PR and between 4ad5118 and 229e08c.

📒 Files selected for processing (6)
  • packages/bruno-converters/src/postman/postman-to-bruno.js
  • tests/import/postman/fixtures/postman-import-apikey-header-collection.json
  • tests/import/postman/fixtures/postman-import-apikey-query-collection.json
  • tests/import/postman/import-apikey-header-collection.spec.ts
  • tests/import/postman/import-apikey-query-collection.spec.ts
  • tests/utils/page/locators.ts

Comment thread tests/utils/page/locators.ts Resolved
Comment thread tests/utils/page/locators.ts Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/bruno-converters/tests/postman/postman-to-bruno/request-auth.spec.js`:
- Around line 635-645: Add a test case to assert unknown Postman "in" values
default to header: in the same suite that uses buildApiKeyCollection and
postmanToBruno, add an it block (e.g., "should default placement to header when
Postman in is unknown") that builds a collection with an apiKey entry including
in: 'random' and then calls postmanToBruno and expects
result.items[0].request.auth.apikey.placement toBe('header'); this verifies
postmanToBruno handles unknown in values the same as a missing in.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 35a1aad4-d2b0-4a95-afcc-132e44b5b047

📥 Commits

Reviewing files that changed from the base of the PR and between 229e08c and b0e649e.

📒 Files selected for processing (7)
  • packages/bruno-app/src/components/RequestPane/Auth/ApiKeyAuth/index.js
  • packages/bruno-app/src/components/Sidebar/ImportCollection/index.js
  • packages/bruno-converters/src/postman/postman-to-bruno.js
  • packages/bruno-converters/tests/postman/postman-to-bruno/request-auth.spec.js
  • tests/import/postman/import-apikey-header-collection.spec.ts
  • tests/import/postman/import-apikey-query-collection.spec.ts
  • tests/utils/page/locators.ts
✅ Files skipped from review due to trivial changes (2)
  • packages/bruno-app/src/components/RequestPane/Auth/ApiKeyAuth/index.js
  • packages/bruno-app/src/components/Sidebar/ImportCollection/index.js
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/bruno-converters/src/postman/postman-to-bruno.js
  • tests/import/postman/import-apikey-query-collection.spec.ts
  • tests/utils/page/locators.ts
  • tests/import/postman/import-apikey-header-collection.spec.ts

Comment thread tests/utils/page/locators.ts Resolved
@bijin-bruno
bijin-bruno merged commit 4fa882c into usebruno:main May 13, 2026
11 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request May 27, 2026
6 tasks
sharan-bruno added a commit to sharan-bruno/bruno that referenced this pull request Jun 4, 2026
… defaults to header (usebruno#7968)

* fix: 3014 - Postman import ignores API Key "in" placement setting and defaults to header

* addressed review comments

* addressed review comment

* addressed review comment - added a test id

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants