Code Monkey home page Code Monkey logo

Comments (4)

mschae avatar mschae commented on July 20, 2024

@hojgr Thanks for your kind words.

As for the behaviour you are seeing - that's expected and by design. Defaults are defaults, by providing your own values overrides the defaults. This is standard in every package I've seen.

My reasoning is that you might want only allow a subset of the default headers. Maybe you explicitly don't want to allow Content-Type headers. Furthermore I like the "explicitness" of this solution. I am using it myself.

The only thing I could think of is to provide a key similar to additional_headers:. But I don't believe that would be very intuitive.

So while this might be a small consolation, maybe it's a tad nicer if you left out the parens:

plug CORSPlug, [
  origin: "http://localhost:4200", 
  headers: ["X-Auth-Token" | CORSPlug.defaults[:headers]]
  ]

Any further feedback and ideas are very welcome!

from cors_plug.

hojgr avatar hojgr commented on July 20, 2024

Thanks for answers. The explicitness is indeed nice and I did not think about the use case where not having defaults is required.

Thanks.

from cors_plug.

mschae avatar mschae commented on July 20, 2024

Glad I could help.

Thanks again for your feedback and please let me know if there is anything I can improve on.

Cheers

from cors_plug.

oppai avatar oppai commented on July 20, 2024

It doesn't work
https://stackoverflow.com/questions/36713069/elixir-phoenix-how-to-use-third-party-modules-in-config-files

from cors_plug.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.