Fix: Invalid JSON on gc-stats (#1801)#4
Conversation
* Fix: Invalid JSON on gc-stats Credits of this patch should be for @jdsundberg, who reported the issue but never sent a patch. Link to his bug report is below. Closes puma#1687. * Update tests so JSON response is correctly parsed JSON without a whitespace between key and values wasn't being correctly parsed (for example: `key: 'value'` was processed ok, but `key:'value'` wasn't).
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||
User description
PR_054
PR Type
Bug fix
Description
Fix invalid JSON generation in gc-stats endpoint
Replace manual string concatenation with proper JSON serialization
Simplify test parsing using standard JSON library
Add JSON require statement to status module
Diagram Walkthrough
File Walkthrough
status.rb
Use proper JSON serialization for gc-statslib/puma/app/status.rb
require 'json'at module topGC.stat.to_jsontest_cli.rb
Simplify JSON parsing in gc-stats testtest/test_cli.rb
require "json"to test fileJSON.parse()