Skip to content

Conversation

@raunak-rpm
Copy link

@raunak-rpm raunak-rpm commented Jan 17, 2026

Summary

This PR adds regression tests to ensure cookie headers are correctly passed to mounted handlers, preventing issue #1618 from recurring.

Related Issue

Closes #1618

Changes

Added 4 new test cases in test/core/mount.test.ts:

  1. preserve cookie header in mounted handler - Basic test for cookie preservation with path prefix
  2. preserve cookie header in mounted handler with prefix option - Test with Elysia's prefix config option
  3. preserve cookie header in mounted handler with aot: false - Test in dynamic mode
  4. preserve multiple cookies in mounted handler - Test multiple cookies in the Cookie header

Background

Issue #1618 reported that cookie headers were not available in mounted handlers in version 1.4.18. After investigation, I found this was fixed in version 1.4.22 through commit c7d7f99.

These regression tests ensure the fix remains in place.

Test Results

All 14 mount tests pass, including the 4 new cookie-related tests.

Summary by CodeRabbit

  • Tests
    • Expanded test coverage for cookie header handling in mounted configurations across various scenarios.

Note: This release contains no user-facing changes.

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

References elysiajs#1618

Added tests to ensure cookie headers are correctly passed to mounted handlers:
- Basic mount with path prefix
- Mount with prefix config option
- Mount with aot: false (dynamic mode)
- Multiple cookies preservation
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 17, 2026

Walkthrough

Test cases added to verify that cookie headers are properly preserved and accessible in mounted handlers across different configuration scenarios, including default mounting, prefix options, and multiple cookie scenarios.

Changes

Cohort / File(s) Summary
Cookie Header Preservation Tests
test/core/mount.test.ts
Added 92 lines of test cases verifying cookie header propagation in mounted handlers under four scenarios: default mounting, mounting with prefix option, mounting with aot: false, and handlers with multiple cookies. Each test sends a request with Cookie header and asserts the response echoes the cookie string.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 Cookies now hop through mounted gates,
No more lost in request states,
Tests ensure they're never shy,
In handlers high, they multiply! 🍪✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding regression tests for cookie preservation in mounted handlers, matching the file modifications and test additions.
Linked Issues check ✅ Passed The PR adds four regression tests that directly verify the fix for issue #1618: cookie headers are correctly passed to mounted handlers across different configurations (default, prefix option, aot: false, multiple cookies).
Out of Scope Changes check ✅ Passed All changes are narrowly scoped to adding regression tests for cookie preservation in mounted handlers; no unrelated code modifications or scope creep detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 17, 2026

Open in StackBlitz

npm i https://pkg.pr.new/elysiajs/elysia@1684

commit: 13ee47e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cookie header not available in mounted handlers without explicit access in onRequest

2 participants