-
-
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
Incorrect type definition for genReqId in FastifyServerOptions #4748
Comments
Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests. |
Yes, I'd be glad to contribute! It may take some time though... |
…ves raw request as argument, not FastifyRequest
BTW, looks like the definition for However, it probably doesn't matter, because this |
…ves raw request as argument, not FastifyRequest
* Fixes #4748: correct type defiinition for genReqId(), it receives raw request as argument, not FastifyRequest * Clarify this in docs * Update docs/Reference/Server.md Co-authored-by: Frazer Smith <frazer.dev@outlook.com> * Improved tests * Removed irrelevant tests --------- Co-authored-by: Frazer Smith <frazer.dev@outlook.com> Co-authored-by: Uzlopak <aras.abbasi@googlemail.com>
Prerequisites
Fastify version
4.17.0
Plugin version
No response
Node.js version
Irrelevant
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Irrelevant
Description
The type of
genReqId
server option implies its only argument is an instance ofFastifyRequest
:However, in practice it is given
RawRequest
(e.g.http.IncomingMessage
):while
FastifyRequest
is created only later in this function.Steps to Reproduce
To reproduce, let's extend the test in
test/genReqId.js
:This test will now fail, because these two props normally found in
FastifyRequest
instance do not actually exist. (Well,id
value is supposed to be provided bygenReqId
in the first place)Expected Behavior
The type definition should be something like this:
The text was updated successfully, but these errors were encountered: