diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index 69b4a54f..e6d2efd7 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -1027,11 +1027,12 @@ 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) # Because of self.options.host @@ -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 diff --git a/test/routing_test.rb b/test/routing_test.rb index f15765a0..795de34c 100644 --- a/test/routing_test.rb +++ b/test/routing_test.rb @@ -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