justintv/restful_jsonp — pull request #1 by Hebo (2012-10-01 23:11:16+00:00)
Title: rewrite this to be a Rack middleware

Rewrite this to use an implementation based on Rack Middleware. This is far more reliable and less error-prone than the previous iteration.

After adding `Rack::JSONP` to our stack, we can enable this for Kraken with

config.middleware.use RestfulJSONP::StatusCodes, [/^\/kraken/]

This fixes some issues with the JS SDK: We use 204 No Content in a lot of API responses, but browsers won't parse the JSONP with that status code, so the SDK breaks.

One issue with this overall approach is that we can't get the original status code, so a future improvement is to encapsulate the original response (including status code).