Repository navigation
fix: coerce numeric header values to string during Postman collection import - #7564
Conversation
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.
WalkthroughHeader values from Postman V2 imports are now explicitly coerced to strings using Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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 | 🟠 MajorApply the same coercion to non-example request headers (Line 530).
brunoRequestItem.request.headers[].valuestill usesheader.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
📒 Files selected for processing (1)
packages/bruno-converters/src/postman/postman-to-bruno.js
Description
JIRA
Summary
200instead of"200")items[N].examples[N].response.headers[N].value must be a 'string' typeheader.valueinString()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.jsheader.value ?? ''→String(header.value ?? '')header.value ?? ''→String(header.value ?? '')Test plan
200as a number)Contribution Checklist:
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