Skip to content

Implement cookie handling with SameSite support and validation.#53

Merged
gustavofreze merged 1 commit intomainfrom
feature/develop
Apr 17, 2026
Merged

Implement cookie handling with SameSite support and validation.#53
gustavofreze merged 1 commit intomainfrom
feature/develop

Conversation

@gustavofreze
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings April 17, 2026 10:04
@gustavofreze gustavofreze merged commit f5b075b into main Apr 17, 2026
8 checks passed
@gustavofreze gustavofreze deleted the feature/develop branch April 17, 2026 10:08
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class Set-Cookie support to the TinyBlocks HTTP response model, including SameSite handling and cookie name/value validation, while improving response header composition to support multi-value headers like Set-Cookie.

Changes:

  • Introduces Cookie and SameSite public APIs and internal validation/value objects for RFC-oriented cookie name/value constraints.
  • Updates internal response header aggregation to preserve multiple header values (enabling multiple Set-Cookie headers) and adds tests around case-insensitive header operations.
  • Documents cookie usage patterns in the README and adds dedicated PHPUnit coverage for cookie serialization and invariants.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/SameSiteTest.php Verifies SameSite enum backed values match Set-Cookie casing.
tests/ResponseWithCookiesTest.php Ensures responses preserve one or multiple Set-Cookie values and coexist with other headers.
tests/HeadersTest.php Adds coverage for withAddedHeader(), case-insensitive header operations, and header merging behavior.
tests/CookieTest.php Covers cookie serialization order, immutability, expires formatting, and invariant exceptions.
src/SameSite.php Adds SameSite backed enum for cookie attribute rendering.
src/Cookie.php Implements an immutable Cookie header value object with fluent builders and serialization.
src/Internal/Cookies/CookieName.php Adds cookie name validation and string conversion.
src/Internal/Cookies/CookieValue.php Adds cookie value validation and string conversion.
src/Internal/Exceptions/*.php Introduces specific exceptions for invalid cookies and invariant violations.
src/Internal/Response/ResponseHeaders.php Changes header merging and adds case-insensitive header lookup/add/replace/remove helpers.
src/Internal/Response/InternalResponse.php Fixes header mutation methods to operate on existing headers instead of replacing them.
README.md Documents cookie creation, multiple cookies, expiration, expires usage, and SameSite rules.
.github/copilot-instructions.md Adds repository-specific Copilot task guidance.
.claude/CLAUDE.md Adds project workflow/testing command guidance.
.claude/rules/*.md Adds Claude rule files for testing, domain modeling, code style, docs, and workflows.

Comment thread README.md
Comment thread src/Internal/Response/ResponseHeaders.php
Comment thread src/Internal/Response/ResponseHeaders.php
Comment thread src/Internal/Response/ResponseHeaders.php
Comment thread src/Internal/Cookies/CookieName.php
Comment thread src/Internal/Cookies/CookieValue.php
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.

2 participants