Conversation
Pass the active response filter through the response copy action so clipboard output matches the filtered JSON view. Add an e2e regression test to verify copy uses filtered JSONPath results.
WalkthroughA Changes
Sequence DiagramsequenceDiagram
participant ResponsePane
participant ResponsePaneActions
participant ResponseCopy
participant formatResponse
ResponsePane->>ResponsePaneActions: Pass filter from focusedTab.responseFilter
ResponsePaneActions->>ResponseCopy: Forward filter prop to component
ResponseCopy->>ResponseCopy: Initialize useResponseCopy hook with filter
ResponseCopy->>formatResponse: Call with filter parameter on clipboard copy
formatResponse-->>ResponseCopy: Return filtered response text
ResponseCopy->>ResponseCopy: Update clipboard with filtered content
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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
🧹 Nitpick comments (1)
tests/response/response-actions.spec.ts (1)
65-104: Consider a negative-path assertion too.The happy path is covered well. A quick follow-up case asserting that clearing the filter restores the full-body copy (or that copy-without-filter still works after this plumbing) would guard against regressions where
filter=''is mistakenly treated as truthy downstream. Optional.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/response/response-actions.spec.ts` around lines 65 - 104, Add a negative-path assertion that verifies clearing the response filter restores full-body copy: after the existing filtered-copy checks, clear the filter input (selector '#response-filter' or use the same UI flow that sets it to ''), trigger the copy action again via clickResponseAction(page, 'response-copy-btn'), wait for the "Response copied to clipboard" toast, then read navigator.clipboard.readText() and assert it equals the original full JSON body (e.g., '{"store":{"book":[{"author":"A"},{"author":"B"}]}}' normalized for line endings); this guards against treating filter='' as truthy and ensures response-copy-btn and the response filter plumbing handle an empty filter correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/response/response-actions.spec.ts`:
- Around line 81-85: The test currently types JSON into the CodeMirror editor
using page.keyboard.type which triggers Bruno's autoCloseBrackets and can
corrupt braces; replace the keystroke approach by targeting the CodeMirror
textarea and calling .fill(...) instead: locate the editor via bodyEditor =
page.getByTestId('request-body-editor').locator('.CodeMirror').first(), then use
bodyEditor.locator('textarea').fill('{"store":{"book":[{"author":"A"},{"author":"B"}]}}')
and remove the keyboard.press/keyboard.type steps so the JSON is set directly
without invoking editor keystroke handlers.
---
Nitpick comments:
In `@tests/response/response-actions.spec.ts`:
- Around line 65-104: Add a negative-path assertion that verifies clearing the
response filter restores full-body copy: after the existing filtered-copy
checks, clear the filter input (selector '#response-filter' or use the same UI
flow that sets it to ''), trigger the copy action again via
clickResponseAction(page, 'response-copy-btn'), wait for the "Response copied to
clipboard" toast, then read navigator.clipboard.readText() and assert it equals
the original full JSON body (e.g.,
'{"store":{"book":[{"author":"A"},{"author":"B"}]}}' normalized for line
endings); this guards against treating filter='' as truthy and ensures
response-copy-btn and the response filter plumbing handle an empty filter
correctly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: aa84d3dd-635f-468c-8834-d3a10cabb51a
📒 Files selected for processing (4)
packages/bruno-app/src/components/ResponsePane/ResponseCopy/index.jspackages/bruno-app/src/components/ResponsePane/ResponsePaneActions/index.jspackages/bruno-app/src/components/ResponsePane/index.jstests/response/response-actions.spec.ts
| const bodyEditor = page.getByTestId('request-body-editor').locator('.CodeMirror').first(); | ||
| await bodyEditor.click(); | ||
| await page.keyboard.press(process.platform === 'darwin' ? 'Meta+a' : 'Control+a'); | ||
| await page.keyboard.type('{"store":{"book":[{"author":"A"},{"author":"B"}]}}'); | ||
| }); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Confirm existing tests use a different pattern when seeding CodeMirror bodies
rg -nP -C2 "request-body-editor" testsRepository: usebruno/bruno
Length of output: 968
🏁 Script executed:
#!/bin/bash
# Search for other keyboard.type usage in tests with CodeMirror
rg -nP "keyboard\.type" tests --type ts --type tsx -C2Repository: usebruno/bruno
Length of output: 85
🏁 Script executed:
#!/bin/bash
# Search for alternative patterns (fill, paste) in CodeMirror contexts
rg -nP "(\.fill\(|clipboard|paste)" tests --type ts --type tsx -C2 | head -100Repository: usebruno/bruno
Length of output: 85
🏁 Script executed:
#!/bin/bash
# Look for CodeMirror configuration in Bruno's codebase
fd -e js -e ts -e tsx | xargs grep -l "CodeMirror" | head -20Repository: usebruno/bruno
Length of output: 1190
🏁 Script executed:
#!/bin/bash
# Check if there's CodeMirror configuration or setup that enables/disables auto-brackets
rg -nP "autoCloseBrackets|matchBrackets|closeBrackets" . --type ts --type tsx --type js -C2 | head -50Repository: usebruno/bruno
Length of output: 85
🏁 Script executed:
#!/bin/bash
# Search for keyboard.type in test files
rg -nP "keyboard\.type" tests -C2 | head -80Repository: usebruno/bruno
Length of output: 5941
🏁 Script executed:
#!/bin/bash
# Search for CodeMirror setup/initialization in Bruno codebase
rg -nP "new CodeMirror|CodeMirror\(" . -C3 | head -100Repository: usebruno/bruno
Length of output: 5149
🏁 Script executed:
#!/bin/bash
# Check for autoCloseBrackets configuration
rg "autoCloseBrackets|bracketMatching" . -C2Repository: usebruno/bruno
Length of output: 1582
🏁 Script executed:
#!/bin/bash
# Look for textarea fill patterns in tests
rg "textarea.*fill|fill.*textarea" tests -C2Repository: usebruno/bruno
Length of output: 15125
🏁 Script executed:
#!/bin/bash
# Read the full test file around the flagged lines
cat tests/response/response-actions.spec.ts | head -100Repository: usebruno/bruno
Length of output: 4218
🏁 Script executed:
#!/bin/bash
# Check for keyboard.type usage specifically with JSON/braces in tests
rg "keyboard\.type.*[{\[\"]" tests -C1 | head -60Repository: usebruno/bruno
Length of output: 2684
Use .fill() on CodeMirror textarea instead of keyboard.type() for JSON body content.
Bruno's CodeMirror has autoCloseBrackets: true enabled, so typing { or [ will auto-insert matching closers. The established pattern in the test suite is to use bodyEditor.locator('textarea').fill(...) to bypass keystroke handlers. This approach is used consistently across 20+ other tests (headers, variables, multipart fields, etc.) and avoids flakiness from bracket corruption.
Proposed fix
- const bodyEditor = page.getByTestId('request-body-editor').locator('.CodeMirror').first();
- await bodyEditor.click();
- await page.keyboard.press(process.platform === 'darwin' ? 'Meta+a' : 'Control+a');
- await page.keyboard.type('{"store":{"book":[{"author":"A"},{"author":"B"}]}}');
+ const bodyEditor = page.getByTestId('request-body-editor').locator('.CodeMirror').first();
+ await bodyEditor.click();
+ await bodyEditor.locator('textarea').fill('{"store":{"book":[{"author":"A"},{"author":"B"}]}}');📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const bodyEditor = page.getByTestId('request-body-editor').locator('.CodeMirror').first(); | |
| await bodyEditor.click(); | |
| await page.keyboard.press(process.platform === 'darwin' ? 'Meta+a' : 'Control+a'); | |
| await page.keyboard.type('{"store":{"book":[{"author":"A"},{"author":"B"}]}}'); | |
| }); | |
| const bodyEditor = page.getByTestId('request-body-editor').locator('.CodeMirror').first(); | |
| await bodyEditor.click(); | |
| await bodyEditor.locator('textarea').fill('{"store":{"book":[{"author":"A"},{"author":"B"}]}}'); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/response/response-actions.spec.ts` around lines 81 - 85, The test
currently types JSON into the CodeMirror editor using page.keyboard.type which
triggers Bruno's autoCloseBrackets and can corrupt braces; replace the keystroke
approach by targeting the CodeMirror textarea and calling .fill(...) instead:
locate the editor via bodyEditor =
page.getByTestId('request-body-editor').locator('.CodeMirror').first(), then use
bodyEditor.locator('textarea').fill('{"store":{"book":[{"author":"A"},{"author":"B"}]}}')
and remove the keyboard.press/keyboard.type steps so the JSON is set directly
without invoking editor keystroke handlers.
There was a problem hiding this comment.
Pull request overview
Fixes an inconsistency where “Copy response” ignored an active JSONPath response filter by passing the current responseFilter through the ResponsePane actions pipeline and into the copy formatter.
Changes:
- Pass the active
responseFilterfromResponsePane→ResponsePaneActions→ResponseCopy. - Apply the filter during copy by forwarding it to
formatResponse(...). - Add a Playwright regression test ensuring filtered JSONPath output is copied.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
tests/response/response-actions.spec.ts |
Adds an E2E regression test validating clipboard contents match filtered JSONPath output. |
packages/bruno-app/src/components/ResponsePane/index.js |
Passes the active focusedTab.responseFilter into the response action components. |
packages/bruno-app/src/components/ResponsePane/ResponsePaneActions/index.js |
Threads the new filter prop through to ResponseCopy. |
packages/bruno-app/src/components/ResponsePane/ResponseCopy/index.js |
Uses formatResponse(..., filter) so copy matches the filtered/processed editor output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fixes : #7832
Description
before : Copy returns the full response even if filter is applied
after : Copy returns filtered result as shown
sc :

Testing
should copy filtered JSONPath result when response filter is applied
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.
Summary by CodeRabbit
New Features