intridea/grape — pull request #414 by benschwarz (2013-05-30 06:31:57+00:00)
Title: OPTIONS requests do not go through the middleware stack

I want to extend the response that an API will return for OPTIONS requests — I started by writing a middleware:

```ruby
class MyAPI < Grape::API
use Grape::Middleware::OptionsException
mount ApiExample
end
```

```ruby
class Grape::Middleware::OptionsException < Grape::Middleware::Base
def call(env)
raise env.inspect
end
end
```

A get request will through the error:

```shell
~ ⚡ curl -I http://localhost:9292/super/special\?id\=1
HTTP/1.1 500 Internal Server Error
Content-Type: text/html
Content-Length: 87978
Server: WEBrick/1.3.1 (Ruby/1.9.3/2012-12-25)
Date: Wed, 29 May 2013 01:49:50 GMT
Connection: Keep-Alive
```

but an options request will not:

```shell
~ ⚡ curl -I -X OPTIONS http://localhost:9292/super/special\?id\=1
HTTP/1.1 204 No Content
Allow: OPTIONS, GET, HEAD
Server: WEBrick/1.3.1 (Ruby/1.9.3/2012-12-25)
Date: Wed, 29 May 2013 01:50:22 GMT
Connection: close
```

Any thoughts, @mbleigh ?