CPAN-API/cpan-api — pull request #173 by grantm (2012-03-25 08:25:41+00:00)
Title: Fix JSONP handling of /source URLs

The JSONP view handler is failing for /source URLs due to the response body being an IO::File object when the code assumed it was a string.

So for example, this URL:

http://api.metacpan.org/source/DOY/Moose-2.0402/MANIFEST?callback=foo

Yields a response body like this:

foo("IO::File=GLOB(0x5e84828)");

The fix in this patch simply slurps the filehandle before adding the JSONP function wrapper. I guess that could potentially be a problem for delivering huge files (although my interest is primarily in using the API to get the MANIFEST and the change log).