hobbit-contrib
hobbit-contrib copied to clipboard
string path as first argument in filter isn't enough
We can create the same path in different HTTP request type. For example:
GET /posts/:id PUT /posts/:id
when we add before('/posts/:id') { ... } before filter will be work for both routes.
Hi @wafcio, I know it's not possible to add filter for specific request methods, and that's because I wanted the filters to be sinatra compatible. You have 2 options:
- Ask for the request method inside the filter:
before '/' do
if request.get?
# do something
end
end
- Create your own hobbit extension. If you do so, we can start growing the hobbit ecosystem and that's great