Created
March 7, 2011 18:34
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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