-
Notifications
You must be signed in to change notification settings - Fork 47
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
Update to helmet v4 #84
Conversation
@@ -129,7 +99,7 @@ test('disabling one header does not disable the other headers', (t) => { | |||
'x-dns-prefetch-control': 'off', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If relevant, there are some other headers that are set by default. You can see that tested in Helmet's source code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@EvanHahn Do you think you could export the |
Does the |
I don't think it would work. I'm getting
|
Can you export that type as well? |
Overall, I have no idea on how to reuse the types from helmet, so any help on this front would be handy. |
Does HelmetOptions extend from FastifyPluginOptions? If not it won't be able to satisfy that constraint (unless you separately copy all the types in FastifyPluginOptions). I haven't looked past just this comment so there may be more details to the solution here. |
As I said, I have no clue about what I'm doing :). If you could push to this branch @Ethan-Arrowood that would be amazing. The types for the options are already fully typed in helmet, so we should be able to reuse that, shouldn't we? |
I'll take a stab now |
@EvanHahn yes please export the option interface! |
Will do! I'll plan to release a new release candidate later today. |
Just published |
Okay so I've done the given type change (which I believe is correct from looking at index.js). But as expected the test file is blowing up. Im assuming the api for helmet has changed in this major? Tomorrow I can look at fixing the test file but I don't totally see the purpose of all the tests if we are strictly dependent on helmet now. The tests would be more valuable on helmet side (might be a good cross project collaboration or good-first-issue on Evan's project) |
You can see the sort of change necessary in the diff from commit 60d9c3a |
I don't think I fully understand the problem, but Helmet 4 introduced some breaking changes which you can see in the changelog. |
Nothing to worry about Evan. The new helmet types are 💯 Either our previous types were a little inaccurate or some things have changed. I only know this because we have a file for testing our type definitions (powered by the tsd library). To complete this PR we need to update that test file so it correctly follows your types. I'll be able to work on this more tomorrow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes fastify/help#225
Checklist
npm run test
andnpm run benchmark