Skip to content

Conversation

sliumdx
Copy link

@sliumdx sliumdx commented Jun 12, 2025

🧩 Ensure Newline After HTTP Body in debug_dev Output

📌 Problem

When using HTTPClient#debug_dev with a shared output (e.g., writing to $stdout), the HTTP response body is written without a trailing newline. This leads to problems when the stream is reused for other log outputs

In some systems, this prevents proper JSON log parsing, causing logs to be dropped entirely.

✅ Solution

This PR ensures that a newline is always written after the HTTP response body when using debug_dev. This makes debug_dev safer to use with shared output streams like $stdout or a Tee stream, where multiple JSON logs may be written in sequence.

🔬 Tests

Two new tests are added to verify this behavior:
• test_debug_dev_shared_dev
• test_debug_dev_stream_shared_dev

These assert that any content appended to the shared debug_dev stream after a request appears on a new line, preventing log merging.

@nahi

@sliumdx sliumdx force-pushed the add-new-line-to-debug-dev-after-body-dump branch from 9b2ab61 to 2aba1db Compare June 13, 2025 20:54
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.

1 participant