-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Change request id header default value to false #4194
Change request id header default value to false #4194
Conversation
generated by running 'node build/build-validation.js' after change on 'build-validation.js'
Changes default from 'request-id' to `false`. Making it opt-in instead of opt-out. NOTE: when user sets requestIdHeader to `true` the behavior is the same as if it was set to `false` because `req.headers[true] || genReqId(req)` is equivalent to `genReqId(req)` (req.headers[true] is undefined). TL;DR requestIdHeader must be a string, else it will be 'ignored'. Solution: Provide a default value for requestIdHeader when `true` or throw.
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.
I don't understand what this gives us other than API churn.
Assuming #4194 gets accepted. I just feel like the default config should be locked down and you can 'open up' instead of you having to 'lock down'. BUT I understand that this might break more things than fix. I can live with the opt-out, just if you don't know about it you might get surprised. |
This could land in v5 whenever we would ship it (likely spring/summer 2023) |
…efault-value-to-false
I investigated this. I kind of agree. Currently fastify will check for the request-id header and take that. Imho it should be opt-out, as @philippviereck suggested. |
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, we should do this for v5
@mcollina it is targetting next branch ;) |
Builds on #4193
This is a breaking change.
I believe the requestIdHeader should be opt-in instead of opt-out.
NOTE: when user sets requestIdHeader to
true
the behaviour is the same as if it was set tofalse
because
req.headers[true] || genReqId(req)
is equivalent to
genReqId(req)
(req.headers[true] is undefined, therefore genReqId will be used).In other words
requestIdHeader
must be astring
, else it will be 'ignored'.Solution: Provide a default value for requestIdHeader when
true
or maybe throw.Checklist
npm run test
andnpm run benchmark
and the Code of conduct