soveran / cuba

Rum based microframework for web development.
http://cuba.is
MIT License
1.44k stars 249 forks source link

Support passing keyword arguments to middlewares #104

Closed Juanmcuello closed 1 year ago

Juanmcuello commented 1 year ago

It seems Cuba is not forwarding kargs to the app, so this is not working for me:

API.use MyMiddleware, foo, bar: 'baz'

I can create a PR to forward kargs if that makes sense. Something like this:

def self.use(middleware, *args, **karsg, &block)
  app.use(middleware, *args, **karsg, &block)
end
Juanmcuello commented 1 year ago

@soveran , just to know if you had a chance to take a look at this. Thanks!

soveran commented 1 year ago

@Juanmcuello Hey! Yes, please create a PR. Use kwargs as the name of that argument.

Thanks!

Juanmcuello commented 1 year ago

Done!