fix: preserve whitespace-only chunks in SSE stream (#139)

* fix: preserve whitespace-only chunks in SSE stream

Fixes issue #138 where Claude models would swallow spaces between words because whitespace-only chunks (e.g., " ") were being filtered out as empty.

Changes:
- Modified sse-streamer.js to only skip truly empty strings (""), preserving strings that contain only whitespace.
- Added regression test case in tests/test-streaming-whitespace.cjs to verify whitespace preservation.

* test: add streaming whitespace regression test to main suite

---------

Co-authored-by: walczak <walczak@ial.ruhr>
This commit is contained in:
Marvin
2026-01-17 07:46:28 +01:00
committed by GitHub
parent f86a0f07c9
commit 480b4a0bc1
3 changed files with 123 additions and 3 deletions

View File

@@ -18,7 +18,8 @@ const tests = [
{ name: 'Cross-Model Thinking', file: 'test-cross-model-thinking.cjs' },
{ name: 'OAuth No-Browser Mode', file: 'test-oauth-no-browser.cjs' },
{ name: 'Empty Response Retry', file: 'test-empty-response-retry.cjs' },
{ name: 'Schema Sanitizer', file: 'test-schema-sanitizer.cjs' }
{ name: 'Schema Sanitizer', file: 'test-schema-sanitizer.cjs' },
{ name: 'Streaming Whitespace', file: 'test-streaming-whitespace.cjs' }
];
async function runTest(test) {