A simple Sinatra app to mimic JSONP to any REST API.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README
jsonp-proxy.rb

README

jsonp-proxy
Mike Mayo <mike@overhrd.com> twitter: @greenisus

Dead simple Sinatra app to make REST API calls and respond in a JSONP style.

Example:

http://localhost:4567/?jsonp=callback&u=https%3A//auth.api.rackspacecloud.com/v1.0

If you included proper headers, you would get something like this back:

callback({ the.response.json });

Request params (all must be URL escaped):

jsonp => callback(response);
u => uri
m => HTTP method (GET, POST, PUT, DELETE, HEAD, etc) default GET
h => request headers hash in json, url encoded
b => request body

Callback argument looks like this:
{ status: 200, headers: { header: hash }, body: 'body text' }