Skip to content

Instantly share code, notes, and snippets.

@pomartel
Created March 7, 2011 18:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pomartel/858939 to your computer and use it in GitHub Desktop.
Save pomartel/858939 to your computer and use it in GitHub Desktop.
Rack application that converts the request from a POST to a GET when a signed_request parameter is present in the request. This lets you develop restful Facebook canvas applications.
# You can put this file in your lib directory.
# Don't forget to add 'use Rack::Facebook' in config.ru.
module Rack
class Facebook
def initialize(app)
@app = app
end
def call(env)
request = Request.new(env)
if request.POST['signed_request']
env["REQUEST_METHOD"] = 'GET'
end
return @app.call(env)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment