Skip to content

vary-3-order does not isolate header order #170

Description

@mnot

Problem

vary-3-order does not isolate what its name claims ("regardless of header order").

https://github.com/http-tests/cache-tests/blob/main/tests/vary.mjs#L247-L263

The setup (vary3Setup) stores the request with Foo: 1, Bar: abc, Baz: 789 and Vary: Foo, Bar, Baz. The test request is:

request_headers: [
  ['Foo', '1'],
  ['Baz', '789'],
  ['Bar', 'abcde']   // <-- different VALUE than stored 'abc'
]
expected_type: 'not_cached'

The headers are reordered and Bar carries a different value (abcde vs stored abc). The not_cached outcome is forced by the value mismatch, not by the ordering — so a cache that ignored header order entirely (but compared values) would still produce not_cached. The "regardless of header order" property is never actually exercised.

abcde also looks like a typo for abc.

Why it matters

The test name and the assertion pull in different directions: the name is about order-insensitivity, but the data tests a plain value mismatch. As written it is just a reordered duplicate of vary-3-no-match.

Suggested fix

Decide which property is intended and make the data match it:

  • To test that reordering alone does not break a match: send the same values in a different order (Foo: 1, Baz: 789, Bar: abc) and expect cached.
  • To keep a no-match test: drop the "regardless of header order" framing, since the value mismatch is what drives it.

Filed from an AI-assisted (Claude Code) review of the tests, with each finding verified by hand and reviewed by a human before filing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions