mschae / cors_plug

An Elixir Plug to add CORS.
https://hex.pm/packages/cors_plug
Other
404 stars 75 forks source link

Passing the conn to the origin function. #51

Closed mattneel closed 4 years ago

mattneel commented 6 years ago

Would it be possible to just pass the conn as an argument to the user-defined origin function in the following code?

https://github.com/mschae/cors_plug/blob/62e32b15c899e3afc10c609283118adaef7e663e/lib/cors_plug.ex#L82

I don't believe this breaks anything, and it would make achieving my use-case much easier (building cors domains based on assigns data).

I'd be happy to submit a PR if it would help.

Thanks, Matt

mschae commented 6 years ago

Hey @mattneel,

that makes sense to me, ideally we can support functions w/o conn (as we do right now) as well as ones that expect a conn.

If you would like to take a stab at this I won't stop you. :)

Thanks