Skip to content

Conversation

@so-iwamoto
Copy link

@so-iwamoto so-iwamoto commented Jan 26, 2026

Description

This PR fixes a bug where gzip-compressed request bodies fail in Bruno CLI while working correctly in Bruno GUI (Developer Mode).

Problem

In packages/bruno-cli/src/runner/interpolate-vars.js, when Content-Type includes json, Buffer data is incorrectly processed by JSON.stringify() because typeof Buffer === 'object'. This destroys the binary data (e.g., gzip-compressed bodies).

Solution

Add !Buffer.isBuffer(request.data) check to skip interpolation for Buffer data.

- if (typeof request.data === 'object') {
+ // Skip interpolation if data is a Buffer (e.g., gzip-compressed data)
+ if (typeof request.data === 'object' && !Buffer.isBuffer(request.data)) {

Why this fix works

The GUI (Developer Mode) version (packages/bruno-electron/src/ipc/network/interpolate-vars.js, line 111) already has this fix. This PR aligns CLI behavior with GUI.

Github Issue: 6921

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.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed handling of compressed and binary request data that was being incorrectly processed during variable interpolation. Request data in certain formats is now preserved without modification.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 26, 2026

Walkthrough

The change adds a Buffer check in the interpolateVars function to skip JSON interpolation when request.data is a Buffer. This prevents unintended interpolation of binary data like gzip-compressed content while maintaining existing behavior for objects and strings.

Changes

Cohort / File(s) Summary
Buffer check for JSON interpolation
packages/bruno-cli/src/runner/interpolate-vars.js
Added Buffer check alongside existing object check to skip JSON interpolation when request.data is a Buffer, preventing interpolation of binary/compressed data

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested reviewers

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

Poem

Binary data, sleek and pristine,
No interpolation's snare between,
A simple guard holds firm and true,
Preserving bytes as meant to do! 🛡️✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 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 change: fixing Buffer handling in variable interpolation for the CLI, which is the core issue addressed in this PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

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