[PR #7556] [MERGED] fix: centralize cookie parsing and handle Expires dates correctly #7397

Closed
opened 2026-03-13 13:34:52 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7556
Author: @bytaesu
Created: 1/22/2026
Status: Merged
Merged: 1/22/2026
Merged by: @himself65

Base: canaryHead: cursor/pr-7555-completion-70e4


📝 Commits (8)

  • 7091cc5 refactor: centralize cookie utilities from Expo to core package
  • 421de20 fix: use parseSetCookieHeader in setCookieToHeader to handle Expires dates correctly
  • 04bf685 chore: remove comment
  • 2391342 chore: export orders
  • 03c1f1c improve splitSetCookieHeader
  • 1c99270 test: add case for Expires handling
  • b5bf6ef fix: lint
  • d3ede1f Update packages/expo/src/client.ts

📊 Changes

3 files changed (+68 additions, -81 deletions)

View changed files

📝 packages/better-auth/src/cookies/cookie-utils.ts (+48 -7)
📝 packages/better-auth/src/cookies/cookies.test.ts (+18 -0)
📝 packages/expo/src/client.ts (+2 -74)

📄 Description

Summary by cubic

Centralized cookie utilities in the core package and removed duplicates from the Expo client. Improves Set-Cookie parsing (handles Expires commas correctly) while keeping Expo APIs compatible.

  • Refactors
    • Moved splitSetCookieHeader to better-auth/cookies and used it in parseSetCookieHeader.
    • Updated setCookieToHeader to use parseSetCookieHeader instead of splitting on commas.
    • Removed local cookie helpers from Expo; Expo now imports and re-exports parseSetCookieHeader from better-auth/cookies for backwards compatibility.

Written for commit d3ede1f24f. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/7556 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 1/22/2026 **Status:** ✅ Merged **Merged:** 1/22/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `cursor/pr-7555-completion-70e4` --- ### 📝 Commits (8) - [`7091cc5`](https://github.com/better-auth/better-auth/commit/7091cc5f487b549dbbb559f3e46929393146821b) refactor: centralize cookie utilities from Expo to core package - [`421de20`](https://github.com/better-auth/better-auth/commit/421de20c629ba98408f9baf1a440e943ff3aeb02) fix: use parseSetCookieHeader in setCookieToHeader to handle Expires dates correctly - [`04bf685`](https://github.com/better-auth/better-auth/commit/04bf6854a397c97e4ef0dbf340f493fa66ca51fc) chore: remove comment - [`2391342`](https://github.com/better-auth/better-auth/commit/239134213d03a9bc932879e4976b19e070161f73) chore: export orders - [`03c1f1c`](https://github.com/better-auth/better-auth/commit/03c1f1cea7018d178c4b967d9595ac824f5149e9) improve splitSetCookieHeader - [`1c99270`](https://github.com/better-auth/better-auth/commit/1c99270d2adb21bfe9af95b8fd22f82056cba310) test: add case for Expires handling - [`b5bf6ef`](https://github.com/better-auth/better-auth/commit/b5bf6efd51c843932fdce6847bb1d346b285b4a3) fix: lint - [`d3ede1f`](https://github.com/better-auth/better-auth/commit/d3ede1f24fa668eec5a818c44bb65a0f6ef6fb8a) Update packages/expo/src/client.ts ### 📊 Changes **3 files changed** (+68 additions, -81 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/cookies/cookie-utils.ts` (+48 -7) 📝 `packages/better-auth/src/cookies/cookies.test.ts` (+18 -0) 📝 `packages/expo/src/client.ts` (+2 -74) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Centralized cookie utilities in the core package and removed duplicates from the Expo client. Improves Set-Cookie parsing (handles Expires commas correctly) while keeping Expo APIs compatible. - **Refactors** - Moved splitSetCookieHeader to better-auth/cookies and used it in parseSetCookieHeader. - Updated setCookieToHeader to use parseSetCookieHeader instead of splitting on commas. - Removed local cookie helpers from Expo; Expo now imports and re-exports parseSetCookieHeader from better-auth/cookies for backwards compatibility. <sup>Written for commit d3ede1f24fa668eec5a818c44bb65a0f6ef6fb8a. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 13:34:52 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#7397