Fix invalid JSON output
-
I’m using the solution from user parse (http://wordpress.org/support/topic/plugin-json-api-strange-behaviour-with-json-output-and-chunked-transfer-encoding) to fix my invalid JSON output and it works great. Delivering the content gzipped is not a problem anymore.
dphiffer, it would be great if you could fix the plugin by adding the Content-length header in your output function (/singleton/response.php) or just provide a hook to add different headers there.
function output($result) { $charset = get_option('blog_charset'); if (!headers_sent()) { header('HTTP/1.1 200 OK', true); header("Content-Type: application/json; charset=$charset", true); <strong>header("Content-Length: " . strlen($result));</strong> } echo $result; }
Many thanks in advance.
Best regards,
Roland
- The topic ‘Fix invalid JSON output’ is closed to new replies.