Skip to content

fix: make binary body test use a local server - #2555

Merged
Mzack9999 merged 1 commit into
devfrom
fix-binary-body-test
Aug 12, 2026
Merged

fix: make binary body test use a local server#2555
Mzack9999 merged 1 commit into
devfrom
fix-binary-body-test

Conversation

@dogancanbakir

@dogancanbakir dogancanbakir commented Aug 12, 2026

Copy link
Copy Markdown
Member

Closes #2552

TestDo/content-length_with_binary_body fetched a w3schools favicon and asserted len(resp.Raw) > 800. That URL now returns a 403 HTML page, so the test fails in CI on all three runners and never tested a binary body. Replaced with an httptest server serving fixed bytes.

Summary by CodeRabbit

  • Tests
    • Improved HTTP client test reliability by replacing an external favicon request with a local test server.
    • Added validation for binary response content and its length.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d0f5a08f-7582-41a8-963b-1eaddec17a68

📥 Commits

Reviewing files that changed from the base of the PR and between 8114098 and 3bee964.

📒 Files selected for processing (1)
  • common/httpx/httpx_test.go

Walkthrough

The binary-body test now uses httptest to serve a fixed GIF payload locally. It verifies the response content length and raw response bytes without contacting an external website.

Changes

HTTP response test

Layer / File(s) Summary
Deterministic binary-body assertions
common/httpx/httpx_test.go
The test adds httptest, serves a fixed GIF response locally, and checks its exact content length and raw bytes.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

I’m a rabbit with a test to run,
No distant favicon, just local fun.
A tiny GIF hops into sight,
Its bytes and length are checked just right.
CI rests easy through the night.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: using a local server for the binary-body test.
Linked Issues check ✅ Passed The changes satisfy issue #2552 by removing the W3Schools dependency and preserving binary-body and content-length validation.
Out of Scope Changes check ✅ Passed The changes are limited to making the targeted binary-body test deterministic and do not introduce unrelated scope.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-binary-body-test

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

@Mzack9999
Mzack9999 merged commit 50b901a into dev Aug 12, 2026
14 checks passed
@Mzack9999
Mzack9999 deleted the fix-binary-body-test branch August 12, 2026 16:42
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.

fix(common/httpx): make the binary-body test independent of W3Schools

2 participants