CPAN-API/cpan-api — pull request #157 by grantm (2012-01-24 08:33:14+00:00)
Title: Allow non-JSON content (e.g.: POD) to be delivered via JSONP

Without this patch, a JSONP request like http://api.metacpan.org/pod/Acme::Orange?callback=my_func would result in the Javascript function wrapper being applied to the text/plain or text/html body.

This patch takes the text body and encodes it as a string in a JSON object before adding the JSONP callback function wrapper. The object key name is determined from the original content type.