Repository navigation
Conversation
pjfanning
reviewed
Nov 26, 2026
pjfanning
left a comment
Member
There was a problem hiding this comment.
A few small comments on the tests, none blocking.
One observation outside this diff: HttpCookiePair.validate only checks nameChars.matchesAll(name), which looks like it is vacuously true for an empty string. If so, HttpCookie("", "dark") is accepted and renders Set-Cookie: =dark, although RFC 6265 requires cookie-name to be a token of at least one character. I have not run this to confirm. It is pre-existing and would belong in a separate PR, but the new "reject a non-token cookie name" test only tries " ", so it does not cover that boundary.
Motivation: The Scala and Java response cookie factories share validation of names and values, but the rejection causes need direct coverage in both DSLs. Modification: Keep response cookie validation in the Scala header spec and add the Java rejection cases to the Java HttpCookie spec. Assert distinct name and content error fragments without duplicating the Java factory's existing successful construction case. Result: Both DSLs check that each invalid argument reaches its intended validation, without changing production behavior. References: RFC 6265 Section 4.1.1.
He-Pin
force-pushed
the
test/typed-response-cookie-factory-validation
branch
from
November 26, 2026 23:57
3b8d427 to
a68457f
Compare
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.
Motivation
The public Scala and Java response HttpCookie factories enforce the shared name and value grammar. Both construction APIs should have direct tests.
Modification
Add local typed constructor tests for ordinary name and value retention and for rejection at the name and value grammar boundaries.
Result
Both public response factories have direct coverage. Production behavior is unchanged.
Tests
git diff --checkpassed. No wire traffic or full CI before opening.References
ServerCookieEncoderTest.