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

add support for the PATCH verb

This commit is contained in:
Konstantin Haase 2011-03-18 19:14:54 +01:00
parent e68e2191f9
commit cdc73c8f5c
2 changed files with 2 additions and 1 deletions

View file

@ -1094,6 +1094,7 @@ module Sinatra
def delete(path, opts={}, &bk) route 'DELETE', 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 head(path, opts={}, &bk) route 'HEAD', path, opts, &bk end
def options(path, opts={}, &bk) route 'OPTIONS', path, opts, &bk end def options(path, opts={}, &bk) route 'OPTIONS', path, opts, &bk end
def patch(path, opts={}, &bk) route 'PATCH', path, opts, &bk end
private private
def route(verb, path, options={}, &block) def route(verb, path, options={}, &block)

View file

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