Giter Site home page Giter Site logo

Comments (11)

EvanHahn avatar EvanHahn commented on May 22, 2024

I agree. I've also thought about a version of this module that does no browser sniffing; is that something you'd want?

from csp.

kara-ryli avatar kara-ryli commented on May 22, 2024

I'm a fan of the entire helmet suite, so I'd be uninterested in a second library. I would, however be happy to send a PR if the maintainers would consider it.

from csp.

kara-ryli avatar kara-ryli commented on May 22, 2024

The API change I would make would be a new option, setLegacyHeaders which supports three values:

  • "auto" - the current default behavior
  • any other truthy value - equivalent of setAllHeaders: true
  • any defined falsey value - only sets the standard header

The default value would be derived from the setAllHeaders config for backwards compatibility, and setAllHeaders would become deprecated.

from csp.

EvanHahn avatar EvanHahn commented on May 22, 2024

Ah, sorry—I didn't mean to suggest I'd make another library.

What about this?

// Current default behavior (these are all equivalent)
csp({})
csp({ setLegacyHeaders: true })
csp({ setAllHeaders: false })

// Always set all headers
csp({ setAllHeaders: true })

// Don't set legacy headers; do no browser sniffing
csp({ setLegacyHeaders: false })

// This throws an error
csp({
  setAllHeaders: true,
  setLegacyHeaders: false
})

from csp.

kara-ryli avatar kara-ryli commented on May 22, 2024

Looks good to me.

from csp.

EvanHahn avatar EvanHahn commented on May 22, 2024

Would you be interested in making a pull request?

from csp.

kara-ryli avatar kara-ryli commented on May 22, 2024

Sure, I'll give it a shot.

from csp.

EvanHahn avatar EvanHahn commented on May 22, 2024

I took bits and pieces of what you did, committed it with you as the author, and added you as a contributor in the package.json. I decided to go with an API of browserSniff: false which eschews all useragent sniffing.

This is released in [email protected] and [email protected].

Thanks for your help!

from csp.

EvanHahn avatar EvanHahn commented on May 22, 2024

@ry7n I'm making a new website for Helmet.js and I want to credit everyone who's contributed. Do you have a name and/or website you'd like me to use to credit you?

from csp.

RCanine avatar RCanine commented on May 22, 2024

Thanks! You can use the name and URL on my Github profile.

from csp.

EvanHahn avatar EvanHahn commented on May 22, 2024

Added you to the list! Stay tuned for the new Helmet documentation website.

from csp.

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.