Skip to content

fix(cli): read x-content-length when Content-Length is missing - #36

Merged
Kikobeats merged 1 commit into
masterfrom
fix/cli-x-content-length
Sep 8, 2026
Merged

fix(cli): read x-content-length when Content-Length is missing#36
Kikobeats merged 1 commit into
masterfrom
fix/cli-x-content-length

Conversation

@Kikobeats

@Kikobeats Kikobeats commented Sep 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Footer size now falls back to x-content-length when Content-Length is absent (Cloudflare brotli).
  • Matches the API header shipped so the browser playground stops printing 0 B.

Test plan

  • search footer reports the response size still passes with Content-Length
  • New test: mock response with only x-content-length prints that size, not 0 B

Made with Cursor

Summary by CodeRabbit

  • Bug Fixes

    • Search result footers now display the correct response size when the standard size information is unavailable.
    • Prevents misleading 0 B sizes from appearing in successful search results.
  • Tests

    • Added end-to-end coverage to verify accurate byte counts in search success footers.

Cloudflare drops Content-Length on brotli responses. The API now exposes the origin size as x-content-length so the browser playground can print it.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 34244871702

Warning

No base build found for commit bc43525 on master.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 77.968%

Details

  • Patch coverage: 2 of 2 lines across 1 file are fully covered (100%).

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 4889
Covered Lines: 3815
Line Coverage: 78.03%
Relevant Branches: 830
Covered Branches: 644
Branch Coverage: 77.59%
Branches in Coverage %: Yes
Coverage Strength: 24.47 hits per line

💛 - Coveralls

@Kikobeats
Kikobeats merged commit 8108df7 into master Sep 8, 2026
8 of 9 checks passed
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 05533870-f489-40ba-a93c-043ae454b3b6

📥 Commits

Reviewing files that changed from the base of the PR and between bc43525 and f6fc41c.

📒 Files selected for processing (2)
  • packages/core/bin/print.js
  • packages/core/test/cli.mjs

📝 Walkthrough

Walkthrough

The CLI footer now uses x-content-length when content-length is unavailable. An end-to-end test verifies the reported byte count and prevents 0 B output.

Changes

CLI response size

Layer / File(s) Summary
Response size fallback and CLI validation
packages/core/bin/print.js, packages/core/test/cli.mjs
printFooter falls back to x-content-length. The CLI test verifies the correct response size and excludes 0 B.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Severity of issue fixed: Low

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/cli-x-content-length

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Kikobeats
Kikobeats deleted the fix/cli-x-content-length branch September 8, 2026 15:30

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f6fc41c. Configure here.

res.statusCode = 200
res.setHeader('content-type', 'application/json')
res.setHeader('x-content-length', bytes)
res.end(body)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Test still sends Content-Length

Low Severity

The new test never leaves content-length unset. Node.js adds that header when res.end is given a body, so the footer still reads content-length and the x-content-length fallback is not exercised. The test would pass without the production change.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f6fc41c. Configure here.

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