Skip to content

Add canonicalization to AccessControlAllowHeadersHeader constructor #149

@coderabbitai

Description

@coderabbitai

Description

This issue tracks an enhancement to improve the AccessControlAllowHeadersHeader.headers constructor by adding canonicalization and validation logic.

Current Behavior

The constructor currently performs basic validation with assertions but doesn't normalize the input headers.

Proposed Enhancement

Apply canonicalization in the constructor to:

  • Trim whitespace from header names
  • Normalize case (e.g., lowercase)
  • Remove duplicates
  • Validate after normalization (assert non-empty, reject wildcards)

This would make the constructor more robust and consistent in handling various input formats.

Context

This enhancement was suggested during code review but deferred to maintain PR focus.

Requested by: @nielsenko
Original discussion: #146 (comment)
Related PR: #146

Benefits

  • More robust input handling
  • Consistent header name formatting
  • Better validation logic
  • Improved user experience when constructing headers

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: headersIssues related to headers.enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Backlog 🗂️

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions