Skip to content

fix: coerce numeric header values to string during Postman collection import - #7564

Merged
bijin-bruno merged 1 commit into
usebruno:mainfrom
abhishek-bruno:fix/postman-import-numeric-header-values
Mar 27, 2026
Merged

bijin-bruno merged 1 commit into
usebruno:mainfrom
abhishek-bruno:fix/postman-import-numeric-header-values

Conversation

@abhishek-bruno

@abhishek-bruno abhishek-bruno commented Mar 24, 2026 •

Copy link
Copy Markdown
Member

Description

JIRA

Summary

  • Postman collections can have numeric values in response/request headers (e.g., 200 instead of "200")
  • Bruno's schema validation expects header values to be strings, causing import to fail with items[N].examples[N].response.headers[N].value must be a 'string' type
  • Wrapped header.value in String() for example request and response headers, matching the existing pattern already used for regular request headers (line 530)

Changes

  • packages/bruno-converters/src/postman/postman-to-bruno.js
    • Example request headers (line 620): header.value ?? '' → String(header.value ?? '')
    • Example response headers (line 721): header.value ?? '' → String(header.value ?? '')

Test plan

  • Import a Postman collection containing responses with numeric header values (e.g., status code 200 as a number)
  • Verify the collection imports successfully without schema validation errors
  • Verify imported header values are preserved correctly as strings

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
    • Enhanced handling of header values when importing Postman collections to ensure consistent processing.

Postman collections can contain numeric header values (e.g., status code 200),
which fail Bruno's schema validation expecting strings. Wrap header.value in
String() for example request and response headers, matching the existing
pattern used for regular request headers.
@coderabbitai

coderabbitai Bot commented Mar 24, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

Header values from Postman V2 imports are now explicitly coerced to strings using String() wrapper, ensuring consistent string type even for non-string Postman header values while maintaining null/undefined fallback behavior.

Changes

Cohort / File(s) Summary
Postman Import Type Coercion
packages/bruno-converters/src/postman/postman-to-bruno.js
Header value fields wrapped with String() coercion for both request headers and response headers in examples, guaranteeing string output type regardless of input type.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Suggested reviewers

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

Poem

Strings so shy, they hide away,
But String() brings them out to play—
No more surprises, typed just right,
Headers gleam in stringy light! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: coercing numeric header values to strings during Postman import, which directly addresses the core problem and solution.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

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

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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/bruno-converters/src/postman/postman-to-bruno.js (1)

620-721: ⚠️ Potential issue | 🟠 Major

Apply the same coercion to non-example request headers (Line 530).

brunoRequestItem.request.headers[].value still uses header.value ?? '' at Line 530. Numeric values there can still fail the same string contract during validation.

🔧 Suggested follow-up patch
-          value: header.value ?? '',
+          value: String(header.value ?? ''),
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bruno-converters/src/postman/postman-to-bruno.js` around lines 620 -
721, The request headers conversion for brunoRequestItem.request.headers is
still using header.value ?? '' which can leave numeric values un-coerced; update
the header value creation in the request headers loop (the code that pushes into
brunoRequestItem.request.headers) to coerce the value to a string the same way
as in the response conversion (use String(header.value ?? '')) so validation
receives a string; locate the loop that populates
brunoRequestItem.request.headers (the one that references
header.key/header.value and pushes an object with name/value) and replace the
value assignment with String(header.value ?? '').
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@packages/bruno-converters/src/postman/postman-to-bruno.js`:
- Around line 620-721: The request headers conversion for
brunoRequestItem.request.headers is still using header.value ?? '' which can
leave numeric values un-coerced; update the header value creation in the request
headers loop (the code that pushes into brunoRequestItem.request.headers) to
coerce the value to a string the same way as in the response conversion (use
String(header.value ?? '')) so validation receives a string; locate the loop
that populates brunoRequestItem.request.headers (the one that references
header.key/header.value and pushes an object with name/value) and replace the
value assignment with String(header.value ?? '').

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9598c39d-535e-4e43-bc4f-433deacc8e3c

📥 Commits

Reviewing files that changed from the base of the PR and between 650ad0f and a841756.

📒 Files selected for processing (1)
  • packages/bruno-converters/src/postman/postman-to-bruno.js

@bijin-bruno
bijin-bruno merged commit 2977fc7 into usebruno:main Mar 27, 2026
7 checks passed
maxenceleblanc pushed a commit to maxenceleblanc/curly_cats2 that referenced this pull request Jul 20, 2026
)

Postman collections can contain numeric header values (e.g., status code 200),
which fail Bruno's schema validation expecting strings. Wrap header.value in
String() for example request and response headers, matching the existing
pattern used for regular request headers.
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.

2 participants