mschae / cors_plug

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

Unreachable code? #64

Closed janpieper closed 4 years ago

janpieper commented 5 years ago

I took a look into the code because I was somehow confused having config :cors_plug, origin: [...] in our config AND plug CORSPlug, origin: &Web.CORS.allowed_origins/0 in the endpoint. I wanted to understand why we have both and which of them has the highest prio.

While doing so, I stumbled upon this:

https://github.com/mschae/cors_plug/blob/1ca97ed844b200f97bc54df83426815854d1235d/lib/cors_plug.ex#L47

It gets called here:

https://github.com/mschae/cors_plug/blob/1ca97ed844b200f97bc54df83426815854d1235d/lib/cors_plug.ex#L42

AFAIK Application.get_all_env/1 will always return a list.

mschae commented 4 years ago

Fixed as of ac31fdcbdd884ea7546946f81e0caffefba3dcda

mschae commented 4 years ago

(Thanks for letting me know!)