Skip to content

test(api): lock the filtered models response against a stale content-length - #15369

Merged
diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.52from
HouMinXi:fix/models-content-length
Oct 6, 2026
Merged

diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.52from
HouMinXi:fix/models-content-length

Conversation

@HouMinXi

@HouMinXi HouMinXi commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The provider models route rewrites the catalog body down to one provider. The upstream content-length belongs to the full catalog, and forwarding it makes the client wait for bytes that never arrive. That was fixed earlier, but nothing kept it fixed.
  • This adds a regression test. It plants a catalog response whose content-length is the full catalog and asserts the filtered response drops it, while a body passed through unchanged keeps its own length.
  • The route exposes the catalog loader as a field so the test can plant that response. The field points at the real loader in production.

Related Issues

Validation

  • Change type: other (regression test)
  • Focused tests: node --import tsx/esm --test tests/unit/provider-models-content-length-15212.test.ts (2 pass)
  • eslint on the changed files, with the repo suppression file
  • Reconciled with release/v3.8.52 @ 23a1148486
  • New test covers the change
  • Defect injection: replacing stripStaleEncodingHeaders with a raw header copy makes the stale-length assertion fail, and the change was restored

Tests Added Or Updated

  • tests/unit/provider-models-content-length-15212.test.ts (added)

Coverage Notes

  • One case filters a catalog and asserts the stale length and encoding are gone. A second case passes a non-JSON body through and asserts its length stays.

Reviewer Notes

…length

The provider models route rewrites the catalog body down to one
provider, so the upstream content-length must not ride along. That was
fixed before, but nothing kept it fixed. This plants a catalog response
whose content-length is the full catalog and asserts the filtered
response drops it, while a body that is passed through unchanged keeps
its own length.

The route exposes the catalog loader as a field so the test can plant
that response. The field points at the real loader in production.

Signed-off-by: Minxi Hou <houminxi@gmail.com>
@HouMinXi
HouMinXi requested a review from diegosouzapw as a code owner October 2, 2026 18:20
@diegosouzapw
diegosouzapw merged commit e8b1a98 into diegosouzapw:release/v3.8.52 Oct 6, 2026
43 of 51 checks passed
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