Repository navigation
Conversation
WalkthroughUnifies multipart form data handling between Postman and Bruno converters through file-aware logic. Distinguishes file items (type: 'file', src property) from text items (type: 'text', value property), with conditional contentType inclusion. Adds comprehensive test coverage for both conversion directions. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@packages/bruno-converters/src/postman/postman-to-bruno.js`:
- Around line 469-471: The current conversion sets value to param.value as-is
for non-file params, allowing undefined/null to pass through and diverging from
bruno-to-postman which uses an empty string; update the non-file branch of the
value assignment so that when param.value is falsy it defaults to '' (e.g. use
the existing Array.isArray(param.value) ? param.value.join('') : param.value ||
'' logic) to ensure text params import as empty strings instead of undefined;
change the expression around the const value assignment that references param
and isFile accordingly.
🧹 Nitpick comments (1)
packages/bruno-converters/src/postman/postman-to-bruno.js (1)
467-482: Duplicated formdata processing — consider extracting a helper.The formdata-to-multipartForm mapping at lines 467–482 is duplicated almost verbatim at lines 652–667 (example body handling). A small shared helper would eliminate this duplication.
♻️ Suggested helper extraction
+const mapFormdataToMultipartForm = (formdata) => { + return (formdata || []).map((param) => { + const isFile = param.type === 'file' || (param.type === 'default' && param.src); + const value = isFile + ? (Array.isArray(param.src) ? param.src : param.src ? [param.src] : []) + : (Array.isArray(param.value) ? param.value.join('') : param.value); + + return { + uid: uuid(), + type: isFile ? 'file' : 'text', + name: param.key, + value, + description: transformDescription(param.description), + enabled: !param.disabled, + ...(param.contentType && { contentType: param.contentType }) + }; + }); +};Then use it in both places:
- each(i.request.body.formdata, (param) => { - // ... duplicated logic - }); + brunoRequestItem.request.body.multipartForm = mapFormdataToMultipartForm(i.request.body.formdata);
Description
Fixed import and export issue in Bruno <-> Postman where an auto type marked file in multipart request was being set as default and no source would be added.
JIRA
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
Release Notes
Bug Fixes
Tests