#bsq -- fix: handle missing location header in redirect error response#7725
Conversation
- Added a check for the presence of the location header in the error response during redirect handling. If the header is absent, the error response is augmented with the timeline and the promise is rejected accordingly.
WalkthroughA guard was added to the redirect-handling logic in the axios instance to prevent processing invalid redirects. When a redirect response lacks a Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Suggested labels
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.
🧹 Nitpick comments (1)
packages/bruno-electron/src/ipc/network/axios-instance.js (1)
330-333: Add explicit error context when rejecting missing-Locationredirects.The guard is correct and prevents the undefined URL path, but it currently rejects without recording why redirect handling stopped. Add a timeline error entry here for clearer diagnostics.
Suggested patch
if (!locationHeader) { + timeline.push({ + timestamp: new Date(), + type: 'error', + message: 'Redirect response missing Location header; aborting redirect handling' + }); error.response.timeline = timeline; return Promise.reject(error); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-electron/src/ipc/network/axios-instance.js` around lines 330 - 333, When the redirect guard sees a missing locationHeader and rejects, add an explicit timeline entry to error.response.timeline describing why redirect handling stopped; for example, before the Promise.reject(error) call push a descriptive entry (e.g., "redirect_missing_location" with a message and any useful context like response.status or headers) into error.response.timeline so diagnostics record the reason; update the block that references locationHeader, error.response.timeline, and Promise.reject(error) to insert that timeline entry prior to rejecting.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/bruno-electron/src/ipc/network/axios-instance.js`:
- Around line 330-333: When the redirect guard sees a missing locationHeader and
rejects, add an explicit timeline entry to error.response.timeline describing
why redirect handling stopped; for example, before the Promise.reject(error)
call push a descriptive entry (e.g., "redirect_missing_location" with a message
and any useful context like response.status or headers) into
error.response.timeline so diagnostics record the reason; update the block that
references locationHeader, error.response.timeline, and Promise.reject(error) to
insert that timeline entry prior to rejecting.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 70b8a60e-3220-4b2f-a55d-9f6a7c7858fa
📒 Files selected for processing (1)
packages/bruno-electron/src/ipc/network/axios-instance.js
fixes: #5880
Description
Contribution Checklist:
Summary by CodeRabbit
Release Notes