Skip to content

Possible to instantiate invalid headers #145

Closed

Description

@nielsenko

Describe the bug

Some typed headers do not do proper validation in their constructors making it possible to create invalid instances.
This will typically cause round-tripping such headers to fail, as the decoding of the malformed encoding will fail.

To reproduce

final x = VaryHeader.headers(fields: []); // note the empty fields list.
final r = Headers.vary.codec.encode(x); // will be empty
final y = Headers.vary.codec.decode(r); // <-- will throw, as empty value not allowed!

Expected behavior

Prevent invalid header instances form being instantiated, ie. validate input in constructor.

Library version

relic: 0.5.0(and prior)

Platform information

any

Additional context

This is related to #144. I believe it may actually be the main (if not sole) reason for the problems with round-tripping.

How experienced are you with this library?

Expert - Experienced and comfortable with using this library in complex projects

Are you interested in working on a PR for this?

  • I want to work on this

Activity

  1. added
    bug
    on Sep 3, 2025
  2. moved this from Inbox 📫 to In Progress 🔥 in Serverpod Frameworkson Sep 4, 2025
  3. changed the title [-]bug: Possible to instantiate invalid headers[/-] [+]Possible to instantiate invalid headers[/+] on Sep 4, 2025
  4. moved this from In Progress 🔥 to Done 🚀 in Serverpod Frameworkson Sep 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions