Skip to content

Instantly share code, notes, and snippets.

@kusor
Created December 12, 2009 16:04
Show Gist options
  • Save kusor/254946 to your computer and use it in GitHub Desktop.
Save kusor/254946 to your computer and use it in GitHub Desktop.
Sinatra HTTP Options
module Sinatra
class Base
def self.http_options(path, opts={}, &bk)
route('OPTIONS', path, opts, &bk )
end
end
module Delegator
delegate :http_options
end
end
module Rack
module Test
class Session
def http_options(uri, params = {}, env = {}, &block)
env = env_for(uri, env.merge(:method => "OPTIONS", :params => params))
process_request(uri, env, &block)
end
end
module Methods
def_delegator :current_session, :http_options
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment