Skip to content

Revert "Save cookies on redirect response" - #6413

Merged
bijin-bruno merged 1 commit into
mainfrom
revert-6094-bugfix/save-cookies-after-redirect
Dec 15, 2025
Merged

bijin-bruno merged 1 commit into
mainfrom
revert-6094-bugfix/save-cookies-after-redirect

Conversation

@bijin-bruno

@bijin-bruno bijin-bruno commented Dec 15, 2025 •

Copy link
Copy Markdown
Collaborator

Reverts #6094 in favour of #5387

Summary by CodeRabbit

  • Bug Fixes
    • Updated cookie persistence handling to prevent automatic cookie saving when HTTP error responses occur. Cookies are now only stored for successful requests, ensuring cleaner session management and more predictable behavior when working with APIs.

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

@coderabbitai

coderabbitai Bot commented Dec 15, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Removed cookie persistence logic from HTTP error response handling in both the CLI and Electron network request runners. Cookies are no longer saved when error responses are received; normal success responses continue to preserve cookies as before.

Changes

Cohort / File(s) Summary
Error Response Cookie Persistence Removal
packages/bruno-cli/src/runner/run-single-request.js,
packages/bruno-electron/src/ipc/network/index.js
Deleted cookie-saving logic in error-handling paths (catch blocks for error.response). Cookies are no longer persisted when HTTP errors occur, while successful responses continue to save cookies normally.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Both changes follow an identical pattern: removal of saveCookies() call in error handling blocks
  • Minimal logic density—straightforward deletion without conditional complexity
  • Consistent across both files reduces reasoning overhead

Possibly related PRs

  • Save cookies on redirect response #6094: Directly related—modifies the same cookie-persistence logic in identical files but in opposing direction (adding cookies to error responses vs. removing them here).

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • naman-bruno

Poem

🍪 No cookies for the wayward response,
When errors strike, we cut the loss,
Success still sweetly bakes its jar,
While failures fade without memoir. ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: reverting a previous commit that added cookie persistence on redirect responses.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch revert-6094-bugfix/save-cookies-after-redirect

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.

@github-actions

Copy link
Copy Markdown

CLI Test Results

  1 files  ±0  140 suites  ±0   54s ⏱️ -10s
235 tests ±0  235 ✅ ±0  0 💤 ±0  0 ❌ ±0 
301 runs  ±0  300 ✅ ±0  1 💤 ±0  0 ❌ ±0 

Results for commit 73b7aea. ± Comparison against base commit 0148178.

@bijin-bruno
bijin-bruno merged commit a9c63e6 into main Dec 15, 2025
@bijin-bruno bijin-bruno mentioned this pull request Dec 15, 2025
5 tasks done
@JeroenVinke

JeroenVinke commented Dec 17, 2025 •

Copy link
Copy Markdown
Contributor

@sanish-bruno can issue #5658 be reopened? I have looked into this a bit further based on the feedback you gave me. Thanks for that, it was very helpful!

It seems that the problem occurs when followredirect = false (which internally means setMaxRedirects(0)). When the server responds with redirect and set-cookie headers, the request is reported as an error, and the cookies are not stored.

When running a single request from electron, the cookies ARE stored after the redirect, but not when running from the CLI or running a folder from electron. So there is a difference in behavior.

The core issue I think is that followredirect is not implemented correctly. Currently when followdirect = false, the result is reported as an error which is not true

image

https://github.com/usebruno/bruno/blob/639c8e573f3086c7e7ab478444058469a962a7fc/packages/bruno-electron/src/ipc/network/axios-instance.js#L280C1-L288C12

I believe the request should be reported as an success when followredirect = false, and the cookies should be stored.

Do you agree with my assessment, and if so, how do you suggest we get this fixed? Thank you for your help

@sanishchirayath1

Copy link
Copy Markdown

@JeroenVinke Thanks for looking further into the issue, I guess we will have to re-open the issue. We are occupied with v3 release. If you strongly feel that 'follow redirects' is the core issue, You can create an Issue/PR. we will look into the issue! But do expect a delay!

We understand that the bug is very annoying. We are extremely sorry that we are unable to prioritise right now. But I do believe, we can get this merged post the holidays!

Thanks for understanding!

@ahamayeah59

Copy link
Copy Markdown

No trouble if you don't have time, but please don't close the issue #5658 because it's not done

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.

4 participants