Skip to content

Resolves issue #1880, fixes JSON whitespace trimming for nested null values and error control flow.#1890

Merged
jdaigneau5 merged 2 commits into
devfrom
dr_1880
Jun 30, 2026
Merged

Resolves issue #1880, fixes JSON whitespace trimming for nested null values and error control flow.#1890
jdaigneau5 merged 2 commits into
devfrom
dr_1880

Conversation

@david-rocca

@david-rocca david-rocca commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Closes Issue #1880

Summary

This PR updates trimJSONWhitespace to avoid queuing null values as objects and prevents double-calling next when an error occurs. It also adds regression coverage for nested null JSON, array trimming, nested object trimming, and single next behavior.

Important Changes

src/middleware/middleware.js

  • Queues only non-null objects for recursive trimming.
  • Returns immediately after next(err) so the success path does not continue after failure.

test/unit-tests/middleware/trimJSONWhitespaceTest.js

  • Adds nested null coverage.
  • Verifies next() is called exactly once on success.
  • Verifies next(err) is called exactly once on failure.
  • Preserves coverage for strings, arrays, nested objects, and non-string values.

test/integration-tests/middleware/trimJSONWhitespaceTest.js

  • Adds Express middleware regression coverage for nested null JSON and nested string trimming.

@david-rocca david-rocca changed the title Dr 1880 Resolves issue #1880, fixes JSON whitespace trimming for nested null values and error control flow. Jun 30, 2026
@jdaigneau5 jdaigneau5 linked an issue Jun 30, 2026 that may be closed by this pull request
6 tasks
@jdaigneau5 jdaigneau5 merged commit 3221933 into dev Jun 30, 2026
9 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.

Fix trimJSONWhitespace handling for nested nulls and error paths

2 participants