Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify README grammar slightly #353

Closed
wants to merge 1 commit into from
Closed

Clarify README grammar slightly #353

wants to merge 1 commit into from

Conversation

zachhardesty7
Copy link

This is a tiny change to adjust the wording from "instead" to "otherwise". I believe this is congruent with the intended meaning of the sentence, but if not, clarification would be appreciated. As a native US English speaker, this sentence confused me for at least a few minutes.

Slightly more technically, the combination of "but" and "instead" here implies (to me) that the preceding clause ("this middleware will work") is unconditionally negated by "you should use app.disable("x-powered-by")". It implies that you should always prefer using app.disable("x-powered-by") instead of this middleware.

I chose not to in the PR, but it could also be written more simply as "If you're not using Express, you should use app.disable("x-powered-by")." It's previously documented that Helmet is a tool for Express, so the reader already knows this middleware works for Express.

@EvanHahn
Copy link
Member

Thanks for this! I'll review in the next 2 weeks or so (things are a bit busy for me right now).

@EvanHahn EvanHahn self-requested a review January 20, 2022 18:20
Copy link
Member

@EvanHahn EvanHahn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think both the original and your amendment aren't 100% clear. Thanks for bringing this to my attention!

I'm trying to convey the following things:

  • If you're not using Express, this middleware will remove the X-Powered-By header.
  • If you are using Express, this middleware will remove the X-Powered-By header, but you'd be better off using Express's built-in functionality for doing this: app.disable("x-powered-by"). But it doesn't really matter.

How about this instead:

Note: Express has a built-in way to disable the X-Powered-By header, which you may wish to use instead of this middleware.

Would that be clearer?

@killshot13
Copy link

killshot13 commented Jan 29, 2022

I think both the original and your amendment aren't 100% clear. Thanks for bringing this to my attention!

I'm trying to convey the following things:

  • If you're not using Express, this middleware will remove the X-Powered-By header.
  • If you are using Express, this middleware will remove the X-Powered-By header, but you'd be better off using Express's built-in functionality for doing this: app.disable("x-powered-by"). But it doesn't really matter.

How about this instead:

Note: Express has a built-in way to disable the X-Powered-By header, which you may wish to use instead of this middleware.

Would that be clearer?

Just adding my two cents here, but the verbiage here has confused me also in the past; to be honest, I would often just use the Helmetjs method and still disable it natively. But yes, @EvanHahn, I find the version you suggested to be the clearest of them all.

@EvanHahn
Copy link
Member

@zachhardesty7 Could you change it to:

Note: [Express has a built-in way to disable the `X-Powered-By` header](https://stackoverflow.com/a/12484642/804100), which you may wish to use instead of this middleware.

If I don't hear back in a few days, I'll just do it myself (which is no problem).

EvanHahn added a commit that referenced this pull request Jan 31, 2022
See [#353][0] for discussion.

[0]: #353
@EvanHahn
Copy link
Member

Did this myself in dbcf9c4. Thanks for bringing up the discussion!

@EvanHahn EvanHahn closed this Jan 31, 2022
@zachhardesty7
Copy link
Author

zachhardesty7 commented Feb 2, 2022

@EvanHahn, thank you for doing that for me, hadn't gotten a chance to check back until now! Ah yes, given the actual intended meaning, my revision was sorta incorrect and your commit is much clearer and makes perfect sense. Just a quick note, you said "you'd be better off" with the Express version, which is not indicated in the revised text. I assume since you said it doesn't really matter, it's not important to recommend one way over the other? This is certainly somewhat pedantic, but since we're already looking at the wording, might as well.

@EvanHahn
Copy link
Member

EvanHahn commented Feb 3, 2022

I think it basically doesn't matter which one you choose.

From a performance perspective, I believe the effect is negligible. I created a simple benchmark app and couldn't find a significant performance difference between the two. It's possible that a more robust benchmark would find a difference, but I doubt it.

From a usability perspective, I also don't think it matters much. Helmet's goal is to be easy to drop in, and I think people can better spend their time on other tasks. If I start highlighting (what I believe to be) a tiny difference in the docs, I fear it might cause confusion.

Does that seem reasonable?

@killshot13
Copy link

Agreed. If there is no performance difference and the verbiage is a bit clearer now, great. But we certainly have more important things to do than critiquing semantics, generally speaking.

@EvanHahn
Copy link
Member

EvanHahn commented Feb 4, 2022

Perfect. If this decision (or any other) seems unclear or wrong, please let me know and we can fix it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants