Added request dynamic headers view#8396
Conversation
WalkthroughRequestHeaders now derives dynamic headers from a dry-run request, lets the user show or hide them, and keeps those rows out of persistence and reordering. EditableTable and row styling now treat read-only rows as non-editable. The app adds an IPC bridge plus Electron handler for dry-run header generation. ChangesDynamic request header preview
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/bruno-app/src/components/RequestPane/RequestHeaders/index.js`:
- Around line 50-56: Add x-wsse to the auth header detection in RequestHeaders
so WSSE credentials are treated like authorization values and masked in the UI.
Update the authHeaderNames useMemo in RequestHeaders/index.js alongside the
existing authorization and apiKey header logic, keeping the same lowercased
Set-based matching so any x-wsse header name is included in the masked header
set.
- Around line 63-68: The dry-run preview in RequestHeaders/index.js can keep
stale data when dryRunHttpRequest fails or returns no headers, so clear the
previous preview before returning on those paths. Update the effect around
dryRunHttpRequest and setDryRunHeaders so that any { error } response, missing
res.headers, or caught rejection resets the headers state to an empty/cleared
value, while still guarding with isMounted before setting new headers.
- Around line 214-228: The new header-preview controls in RequestHeaders should
expose stable Playwright selectors. Add data-testid attributes to the
interactive elements in the isAuthHeader block and the dynamic-header toggle so
tests can target them reliably; use the existing RequestHeaders component
structure and the click handlers that dispatch updateRequestPaneTab and toggle
showAuthValue to identify the right elements. Keep the test ids stable and
unique for the reveal/show-hide control and the go-to-authorization control, and
apply the same pattern to the dynamic-header toggle referenced in the related
section.
In
`@packages/bruno-app/src/components/RequestPane/RequestHeaders/StyledWrapper.js`:
- Around line 41-44: The .read-only styling in StyledWrapper is blocking
interaction for preview rows by disabling pointer events, which prevents focus,
selection, and copy. Update the read-only styling so it still allows text
selection while keeping the visual disabled state, and leave readOnly behavior
enforcement to SingleLineEditor; reference the .read-only rule in StyledWrapper
when making the change.
In `@packages/bruno-electron/src/ipc/network/index.js`:
- Around line 1354-1396: The dry-run flow in
ipcMain.handle('dry-run-http-request') skips the same pre-request mutation step
used by runRequest(), so previewed headers can differ from the real send path.
Update this handler to run the equivalent pre-request logic before calling
configureRequest(), using the existing prepareRequest(), interpolateVars(), and
any runPreRequest-related helper used by runRequest(), so header changes from
scripts/variables are reflected in the preview.
- Around line 1387-1396: The dry-run path in the IPC handler is reusing the
send-time auth setup, which can eagerly resolve OAuth2 credentials when
RequestHeaders renders. Update the code around configureRequest() in the network
IPC flow so the Headers pane uses a non-authenticated/lightweight request
configuration and does not invoke token fetch/refresh or interactive auth flows
until the actual send action. Keep the fix localized to the request-building
path used by RequestHeaders and the configureRequest helper.
🪄 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: 6ee1d4c4-80f5-495c-90ad-de8e25734ece
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (5)
packages/bruno-app/src/components/EditableTable/index.jspackages/bruno-app/src/components/RequestPane/RequestHeaders/StyledWrapper.jspackages/bruno-app/src/components/RequestPane/RequestHeaders/index.jspackages/bruno-app/src/utils/network/index.jspackages/bruno-electron/src/ipc/network/index.js
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-electron/src/ipc/network/index.js (1)
1436-1441: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winMatch Axios interceptor order before building the dry-run header preview. Axios request interceptors run in LIFO order and honor
runWhen, but this loop walksinterceptors.request.handlersin registration order and invokes everyfulfilledhandler. That can make the preview headers differ from the real request when multiple request interceptors are registered here.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/bruno-electron/src/ipc/network/index.js` around lines 1436 - 1441, The dry-run header preview in the axios request flow is applying request interceptors in the wrong way, so it can diverge from the real request. Update the interceptor replay in the network IPC code to match Axios request interceptor behavior: execute request interceptors in LIFO order and respect each interceptor’s runWhen predicate before calling its fulfilled handler. Use the existing axiosInstance.interceptors.request.handlers logic in the dry-run path so the preview produced from finalRequest matches what Axios will actually send.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@packages/bruno-electron/src/ipc/network/index.js`:
- Around line 1436-1441: The dry-run header preview in the axios request flow is
applying request interceptors in the wrong way, so it can diverge from the real
request. Update the interceptor replay in the network IPC code to match Axios
request interceptor behavior: execute request interceptors in LIFO order and
respect each interceptor’s runWhen predicate before calling its fulfilled
handler. Use the existing axiosInstance.interceptors.request.handlers logic in
the dry-run path so the preview produced from finalRequest matches what Axios
will actually send.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: bd068a14-d2c6-4fb5-80b5-15e974d6e387
📒 Files selected for processing (3)
packages/bruno-app/src/components/RequestPane/RequestHeaders/StyledWrapper.jspackages/bruno-app/src/components/RequestPane/RequestHeaders/index.jspackages/bruno-electron/src/ipc/network/index.js
💤 Files with no reviewable changes (1)
- packages/bruno-app/src/components/RequestPane/RequestHeaders/StyledWrapper.js
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/bruno-app/src/components/RequestPane/RequestHeaders/index.js
Description
Introduces the ability to preview dynamic and hidden request headers (e.g.: content-type, authorization, user-agent) directly in the UI before sending the request. This can be very important to find or make it more obvious for the user specific errors when debugging.
Design Decisions
1. Dry-Run
Replicating complex request logic on the frontend simply to calculate headers would be error-prone, brittle, and lead to duplicated code.
Instead, I introduced a
dry-run-http-requestIPC handler. This allows us to run the request through the exact same backend pipeline. The pipeline is aborted, and the final evaluated headers are returned to the UI. This guarantees 100% accuracy on the displayed headers.Contribution Checklist:
Summary by CodeRabbit
New Features
Bug Fixes
UI Improvements