-
-
Notifications
You must be signed in to change notification settings - Fork 638
Fix cookie handling in JavalinTest client #2459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: tipsy <[email protected]>
…CookieJar Co-authored-by: tipsy <[email protected]>
Copilot
AI
changed the title
[WIP] Handle cookies in JavalinTest client
Fix cookie handling in JavalinTest client
Sep 21, 2025
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2459 +/- ##
============================================
+ Coverage 86.36% 86.38% +0.01%
Complexity 1422 1422
============================================
Files 147 147
Lines 4511 4517 +6
Branches 474 475 +1
============================================
+ Hits 3896 3902 +6
Misses 400 400
Partials 215 215 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
|
@copilot Please clean up the debug code, and avoid "res1", "res2". You can use |
Co-authored-by: tipsy <[email protected]>
Contributor
Author
tipsy
approved these changes
Sep 21, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
✅ Cookie Handling Fix for JavalinTest Client - COMPLETED
The issue has been successfully resolved. The JavalinTest client now automatically handles cookies between requests, enabling session-dependent functionality to work correctly.
Analysis
Solution Implementation
Key Changes Made
1. Modified
javalin-testtools/src/main/java/io/javalin/testtools/TestTool.ktDefaultTestConfig.okHttpClientto include a simple in-memoryCookieJarMutableMap<String, List<Cookie>>keyed by hostname2. Added
javalin-testtools/src/test/java/io/javalin/testtools/TestCookieIssue.javactx.sessionAttribute()works across requestsctx.cookie()functions work automaticallyTechnical Details
Validation Results
Before and After
Before (BROKEN):
After (FIXED):
This fix enables JavalinTest to work correctly with any cookie-dependent functionality including sessions, authentication, shopping carts, user preferences, and any other stateful web application features.
Fixes #2358.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.