You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add integration test to show missing documented DSL method (.insert)
It is documented in the README for this project that there is a DSL method (`.insert`) that can be utilised but this is not the case.
The notable passage is:
```
You can add your custom middleware with use, that push the middleware onto the stack, and you can also control where the middleware is inserted using insert, insert_before and insert_after.
```
The notable example of this is:
```
class CustomOverwriter < Grape::Middleware::Base
def after
[200, { 'Content-Type' => 'text/plain' }, [@options[:message]]]
end
end
class API < Grape::API
use Overwriter
insert_before Overwriter, CustomOverwriter, message: 'Overwritten again.'
insert 0, CustomOverwriter, message: 'Overwrites all other middleware.'
get '/' do
end
end
```
This method is not actually available though and when invoked will raise a NoMethodError. This appears to have just been an error of omission in the original commit adding the middleware stack and extending the DSL to include the ability to interact with it in a more granular fashion (c2e41f7).
This commit adds a failing test case which attempts to utilise this documented feature.
0 commit comments