Skip to content

fix(curl-import): treat inline --data-binary as body, not file - #8617

Merged
sachin-thakur-bruno merged 12 commits into
usebruno:mainfrom
pooja-bruno:fix/curl-import-data-binary-inline-body
Jul 29, 2026
Merged

fix(curl-import): treat inline --data-binary as body, not file#8617
sachin-thakur-bruno merged 12 commits into
usebruno:mainfrom
pooja-bruno:fix/curl-import-data-binary-inline-body

Conversation

@pooja-bruno

@pooja-bruno pooja-bruno commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Description

Fixes #8542 — importing a cURL command that uses --data-binary with an inline payload (not a @file reference) failed.

curl's --data-binary flag sets isDataBinary = true for both inline data and @file references. The importer's file-body branch only checked that flag, so inline JSON was assigned to body.file as a string. Since serialization assumes body.file is an array and calls .map() on it, this:

crashed the New Request → From cURL flow with e.file?.map is not a function, andsilently dropped the body when pasting the cURL into the URL bar.

JIRA

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.

Screen.Recording.2026-07-15.at.2.28.54.PM.mov

Summary by CodeRabbit

Summary

  • Bug Fixes

    • Corrected cURL import handling for --data-binary so inline payloads are treated as request body content, while @file references still import in file/binary mode.
  • Tests

    • Added Jest coverage for inline JSON vs @file --data-binary.
    • Added Playwright import tests validating the New Request UI body mode and expected editor/table contents.
  • Refactor

    • Improved test locator utilities by consolidating request locators for easier reuse.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

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

Walkthrough

The cURL importer now distinguishes inline JSON from file-based --data-binary payloads. Reusable Playwright helpers and unit/end-to-end tests cover both import paths.

Changes

cURL binary import

Layer / File(s) Summary
Binary body parsing and unit coverage
packages/bruno-app/src/utils/curl/index.js, packages/bruno-app/src/utils/curl/parse-curl.spec.js, packages/bruno-app/src/utils/curl/index.spec.js
Binary data enters file mode only when the parsed body is an array; unit tests cover inline JSON preservation and file references.
Request locators and cURL creation helper
tests/utils/request/index.ts, tests/utils/page/locators.ts
Request and New Request dialog locators are extracted into reusable helpers, including a flow for creating requests from cURL commands.
End-to-end binary import coverage
tests/import/curl/import-curl-data-binary.spec.ts
Playwright tests verify JSON mode for inline payloads and File mode for @ file references.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • usebruno/bruno#6295: Wires cURL parsing into request-pane paste handlers used by this import flow.
  • usebruno/bruno#7210: Also tightens --data-binary handling to distinguish inline data from file references.

Suggested reviewers: bijin-bruno

Poem

Binary bytes split their ways,
JSON shines and file mode stays.
Locators guide the request flight,
Tests guard both paths bright.

ðŸšĨ 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 accurately summarizes the main change: inline --data-binary is treated as a body instead of a file.
Linked Issues check ✅ Passed The fix and added tests address the Charles cURL import failure by preserving inline --data-binary payloads as request bodies.
Out of Scope Changes check ✅ Passed The added test utilities and Playwright coverage are supporting changes for the curl-import fix, not unrelated scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
âœĻ 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.

pooja-bruno and others added 5 commits July 15, 2026 14:50
The 'accept word' shortcut added in usebruno#8607 introduced a second
<kbd>{modifier}</kbd> in the keymap, so getByText(modifier) now throws
on multiple matches. Use getAllByText to assert all occurrences.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@Gopi-bruno Gopi-bruno 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.

LGTM

@sachin-thakur-bruno sachin-thakur-bruno left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Tested locally and working fine.

@sachin-thakur-bruno
sachin-thakur-bruno merged commit 97efc86 into usebruno:main Jul 29, 2026
23 of 26 checks passed
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.

cURL imported from Charles fails to import in Bruno

3 participants