Re: [ANN] encors: CORS middleware for Ring apps

2014-12-03 Thread David Dossot
Just to let everyone know that we've just released version 2.0 of encors, with these suggested changes in place. The middleware should now feel more Clojure-ish and Ring-ish :) Thanks James for the great feedback. On Wednesday, November 26, 2014 4:31:37 PM UTC-8, Román González wrote: > > Good

Re: [ANN] encors: CORS middleware for Ring apps

2014-11-26 Thread Román González
Good points... So possible changes: * Replace the get-policy-for-req argument with a just policy-options map This makes it easier to validate options just once. I guess all the validations done on a simple Request -> CorsPolicy function can be done by composing middleware together (e.g. Middlewa

Re: [ANN] encors: CORS middleware for Ring apps

2014-11-26 Thread James Reeves
On 26 November 2014 at 23:08, wrote: > map->CorsPolicy enforces correctness of input, this way the wrap-cors > functions doesn't need to validate data. Probably we can add a call to > map->CorsPolicy as the first thing of wrap-cors function and keep this > function private. > In Clojure, types a

Re: [ANN] encors: CORS middleware for Ring apps

2014-11-26 Thread Román González
James, I have second thoughts on including map->CorsPolicy to the internal API... Given that we are returning a Policy per request call, calling a map->CorsPolicy every time we call warp-cors sounds a bit overkill performance wise... Instead of validating development settings once when the namespa

Re: [ANN] encors: CORS middleware for Ring apps

2014-11-26 Thread roman
map->CorsPolicy enforces correctness of input, this way the wrap-cors functions doesn't need to validate data. Probably we can add a call to map->CorsPolicy as the first thing of wrap-cors function and keep this function private. Thanks for the suggestion. On Tuesday, November 25, 2014 5:27:12

Re: [ANN] encors: CORS middleware for Ring apps

2014-11-25 Thread James Reeves
I mentioned this on r/clojure, but don't understand why you have a map->CorsPolicy function, as it doesn't appear to serve any purpose. You seem to be using it as a map, but in Clojure it's more idiomatic to use maps as maps. - James On 25 November 2014 at 23:40, wrote: > It is our pleasure to

[ANN] encors: CORS middleware for Ring apps

2014-11-25 Thread roman
It is our pleasure to announce a new ring middleware for CORS support. https://github.com/unbounce/encors Features include: * Add multiple CORS Policy to an app (can classify them via ring request info) * Preflight CORS requests are supported * Thoroughly tested (around 276 different assertio