Permalink
Browse files

Add HTTP verb: OPTIONS

  • Loading branch information...
1 parent 0529e92 commit a4a06f83587e3aca62282ca8949b2030356ba0f3 @grimen grimen committed Dec 17, 2011
Showing with 3 additions and 2 deletions.
  1. +1 −0 lib/grape/api.rb
  2. +2 −2 spec/grape/api_spec.rb
View
@@ -284,6 +284,7 @@ def post(paths = ['/'], options = {}, &block); route('POST', paths, options, &bl
def put(paths = ['/'], options = {}, &block); route('PUT', paths, options, &block) end
def head(paths = ['/'], options = {}, &block); route('HEAD', paths, options, &block) end
def delete(paths = ['/'], options = {}, &block); route('DELETE', paths, options, &block) end
+ def options(paths = ['/'], options = {}, &block); route('OPTIONS', paths, options, &block) end
def namespace(space = nil, &block)
if space || block_given?
View
@@ -238,13 +238,13 @@ def app; subject end
"lol"
end
- %w(get post put delete).each do |m|
+ %w(get post put delete options).each do |m|
send(m, '/abc')
last_response.body.should eql 'lol'
end
end
- verbs = %w(post get head delete put)
+ verbs = %w(post get head delete put options)
verbs.each do |verb|
it "should allow and properly constrain a #{verb.upcase} method" do
subject.send(verb, '/example') do

0 comments on commit a4a06f8

Please sign in to comment.