#199

fix(testing): preserve no-content responses in fixture helpers

Opensdivyanshu90wants to merge intofrom

Fixes #197.

I preserved an absent response body when fixture recording and replay reconstruct HTTP 204, 205, or 304. Previously, replay serialized null as a body and recording passed an empty string; both threw in the Response constructor before the connector could inspect the status.

Regression coverage exercises all three statuses, null and empty fixture representations, record→replay, status/header preservation, and credential-header filtering. A 200 JSON-null response remains a payload. No fixture schema or transport ABI changes are needed.

Validation (Deno 2.9.7):

  • Both no-content regressions fail before the fix. Fixture suite: 13 passed, 0 failed.
  • All 251 test modules imported into one temporary shared-process entry point: 1,301 passed, 0 failed, 221 gated live tests ignored. This is not a standard isolated-module deno task test run.
  • deno task check, deno task lint, changed-file deno fmt --check, git diff --check, and deno task version:check --base upstream/main pass.

@ooctoo777, could you review and merge this fix?

Summary by CodeRabbit

  • Bug Fixes
    • Recorded and replayed responses with status codes 204, 205, and 304 now correctly have no body, including when fixtures contain a null or empty body.
    • Responses with status 200 continue to preserve JSON null as a body.

Activity

2
coderabbitai[bot]7d ago

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 09d54479142e36eff876383beacfbd37b33b5908 and b4e9754ba34c1ff9f2ff8e590cb161ac2463c5f6.

Files selected for processing: 2
  • shared/testing/fixture-size.test.ts
  • shared/testing/fixtures.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Walkthrough

replayFetch and recordingFetch now construct responses with null bodies for statuses 204, 205, and 304. Tests verify status and header handling, empty response bodies, and that a JSON null payload remains a body for status 200.

Priority: Normal

Severity of issue fixed: Medium

Merge Risk: Minimal · up to b4e97

The fixture change appears ready to merge after normal checks; no actionable remaining risk was identified.

Pre-merge checks: 4
Check nameStatusExplanation
Description CheckCheck skipped - CodeRabbit’s high-level summary is enabled.
Title checkThe title clearly and concisely describes preserving no-content responses in the fixture helpers, which is the main change.
Linked Issues checkIssue #197 requires bodyless reconstruction for statuses 204, 205, and 304. replayFetch now passes null for those statuses, including fixtures with null and empty-string bodies. recordingFetch…
Out of Scope Changes checkThe diff changes only fixture reconstruction and its regression tests. The changes preserve existing headers and ordinary response-body behavior. No binary or multipart transport work from #170 is inc…
Full details: Linked Issues check

Explanation

Issue #197 requires bodyless reconstruction for statuses 204, 205, and 304. replayFetch now passes null for those statuses, including fixtures with null and empty-string bodies. recordingFetch also passes null for those statuses. The tests cover all three statuses, record-to-replay, allowlisted headers, credential-header filtering, and a status-200 JSON null payload.

Full details: Out of Scope Changes check

Explanation

The diff changes only fixture reconstruction and its regression tests. The changes preserve existing headers and ordinary response-body behavior. No binary or multipart transport work from #170 is included.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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