kazeburo / Plack-Middleware-ServerStatus-Lite

Plack-Middleware-ServerStatus-Lite
Other
26 stars 11 forks source link

Fix JSON types unexpectedly changed at 0.35 #20

Closed astj closed 8 years ago

astj commented 8 years ago

Before 0.35, Uptime parameter from response of {path}?json was a JSON string. (its value was quoted by ") But at 0.35, It (maybe unexpectedly) changed to a JSON number, caused by commit 1fd7e6b0dfd05a16630a8ba0d25e367efb52541f.

In pre-0.35, $self->{uptime} was flagged as string by string interpolation at https://github.com/kazeburo/Plack-Middleware-ServerStatus-Lite/pull/18/files#diff-1df032baeeed2a3067f85e5d3b0d565dR158 . But 1fd7e6b0dfd05a16630a8ba0d25e367efb52541f removed the interpolation, so JSON::encode_json converts $stats{Uptime} = $self->{uptime} to a JSON number.

The change at 0.35 breaks some parser like mackerel-agent-plugin, which expects it's a JSON string. So I'd like to change it back to JSON String.

kazeburo commented 8 years ago

Thank you