Conversation
Added a toString() override that returns `name + "=" + value`.
There was a problem hiding this comment.
Pull request overview
Fixes incorrect Cookie request header formatting by ensuring ClientCookie.toString() returns a standard name=value representation, restoring load balancer session affinity behavior for multi-statement transactions in the Java client.
Changes:
- Added
ClientCookie.toString()override to emitname=value. - Added
ClientCookieTestwith coverage for normal and empty-value cookie formatting.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| marklogic-client-api/src/main/java/com/marklogic/client/ClientCookie.java | Overrides toString() so cookies serialize as name=value for request header usage. |
| marklogic-client-api/src/test/java/com/marklogic/client/test/ClientCookieTest.java | Adds unit tests validating ClientCookie.toString() output for typical and empty-value cases. |
Comment on lines
+59
to
+62
| @Override | ||
| public String toString() { | ||
| return name + "=" + value; | ||
| } |
rjrudin
approved these changes
Jun 23, 2026
RitaChen609
approved these changes
Jun 24, 2026
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
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.
Summary
Fixes a bug where
ClientCookie.toString()returned the defaultObject.toString()value(
com.marklogic.client.ClientCookie@<hashcode>) instead ofname=value. This causedOkHttpServices.addCookies()to set a malformedCookierequest header, silently breakingload balancer session affinity (e.g., HAProxy HostId affinity) for multi-statement transactions.
Requests could land on different backend nodes, resulting in
XDMP-NOTXN: No transaction with identifiererrors.Changes
ClientCookie.java— AddedtoString()override returningname + "=" + valueClientCookieTest.java— New unit test class with two tests covering the standardname=valueformat and the empty-value edge caseTesting
ClientCookieTestpasses (no MarkLogic instance required)Related