diff options
author | Pete Elmore <pete@debu.gs> | 2013-10-21 17:13:11 -0700 |
---|---|---|
committer | Pete Elmore <pete@debu.gs> | 2013-10-21 17:13:11 -0700 |
commit | 3ea1174a4cbcde0def63b945b7efed2161c04850 (patch) | |
tree | e09a7cc1f29a555bb018f7de1b7ab691ce9dd853 /lib/rack/mock.rb | |
parent | 1f47a4478546602d3c17902cc3faf42b106f0638 (diff) | |
download | rack-3ea1174a4cbcde0def63b945b7efed2161c04850.tar.gz |
Add OPTIONS support to File and MockRequest.
Also update the specs for same. RFC 2616, section 9.2 specifies OPTIONS requests. Not much effort to support it for this case; there's already an ALLOWED_VERBS cosntant in Rack::File, and the spec describes the body of the request as optional.
Diffstat (limited to 'lib/rack/mock.rb')
-rw-r--r-- | lib/rack/mock.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/rack/mock.rb b/lib/rack/mock.rb index ac7ef08c..3ba314e4 100644 --- a/lib/rack/mock.rb +++ b/lib/rack/mock.rb @@ -53,12 +53,13 @@ module Rack @app = app end - def get(uri, opts={}) request("GET", uri, opts) end - def post(uri, opts={}) request("POST", uri, opts) end - def put(uri, opts={}) request("PUT", uri, opts) end - def patch(uri, opts={}) request("PATCH", uri, opts) end - def delete(uri, opts={}) request("DELETE", uri, opts) end - def head(uri, opts={}) request("HEAD", uri, opts) end + def get(uri, opts={}) request("GET", uri, opts) end + def post(uri, opts={}) request("POST", uri, opts) end + def put(uri, opts={}) request("PUT", uri, opts) end + def patch(uri, opts={}) request("PATCH", uri, opts) end + def delete(uri, opts={}) request("DELETE", uri, opts) end + def head(uri, opts={}) request("HEAD", uri, opts) end + def options(uri, opts={}) request("OPTIONS", uri, opts) end def request(method="GET", uri="", opts={}) env = self.class.env_for(uri, opts.merge(:method => method)) |