evert0n / koa-cors

CORS middleware for Koa
MIT License
243 stars 48 forks source link

Handles options.origin as function #15

Closed petuomin closed 9 years ago

petuomin commented 10 years ago

Makes it possible to pass a function as options.origin. The function gets request object as parameter and should return the string for 'Access-Control-Allow-Origin' header, or false to prevent the header from being set.

There is a simple example in the tests.

rehno-lindeque commented 10 years ago

:+1: Although the documentation claims...

Can also be set to a function, which takes the request as the first parameter.

...it looks like this change is required to actually implement it.

evert0n commented 9 years ago

Thanks and sorry it took long to look at it.

rehno-lindeque commented 9 years ago

Thanks for merging