1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

Added support for OPTIONS request type.

Signed-off-by: Konstantin Haase <konstantin.mailinglists@googlemail.com>
This commit is contained in:
jammur 2010-11-29 15:03:08 -05:00 committed by Konstantin Haase
parent 2943e9383b
commit 4d0b7403ac
2 changed files with 8 additions and 7 deletions

View file

@ -1027,10 +1027,11 @@ module Sinatra
route('HEAD', path, opts, &block)
end
def put(path, opts={}, &bk); route 'PUT', path, opts, &bk end
def post(path, opts={}, &bk); route 'POST', path, opts, &bk end
def delete(path, opts={}, &bk); route 'DELETE', path, opts, &bk end
def head(path, opts={}, &bk); route 'HEAD', path, opts, &bk end
def put(path, opts={}, &bk); route 'PUT', path, opts, &bk end
def post(path, opts={}, &bk); route 'POST', path, opts, &bk end
def delete(path, opts={}, &bk); route 'DELETE', path, opts, &bk end
def head(path, opts={}, &bk); route 'HEAD', path, opts, &bk end
def options(path, opts={}, &bk); route 'OPTIONS', path, opts, &bk end
private
def route(verb, path, options={}, &block)
@ -1363,7 +1364,7 @@ module Sinatra
end
end
delegate :get, :put, :post, :delete, :head, :template, :layout,
delegate :get, :put, :post, :delete, :head, :options, :template, :layout,
:before, :after, :error, :not_found, :configure, :set, :mime_type,
:enable, :disable, :use, :development?, :test?, :production?,
:helpers, :settings

View file

@ -23,7 +23,7 @@ class RegexpLookAlike
end
class RoutingTest < Test::Unit::TestCase
%w[get put post delete].each do |verb|
%w[get put post delete options].each do |verb|
it "defines #{verb.upcase} request handlers with #{verb}" do
mock_app {
send verb, '/hello' do