Skip to content

Fix onRequest hook documentation#302

Merged
mcollina merged 3 commits intofastify:masterfrom
mattiapv:master
Oct 4, 2023
Merged

Fix onRequest hook documentation#302
mcollina merged 3 commits intofastify:masterfrom
mattiapv:master

Conversation

@mattiapv
Copy link
Contributor

@mattiapv mattiapv commented Aug 9, 2023

Added missing async and await keywords, try...catch block. This prevents server crashes caused by missing await on jwtVerify() function.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

None of this are needed, why did you add them?

@mattiapv
Copy link
Contributor Author

mattiapv commented Aug 10, 2023

None of this are needed, why did you add them?

Because without awaiting jwtVerify() the server crash.

You can try the cookie or the onlyCookie example.

If you make a call to http://localhost:3000/verifyCookie the server crash.

If I add await request.jwtVerify(), I receive the correct error (FST_JWT_NO_AUTHORIZATION_IN_HEADER) and the server doesn't crash.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina merged commit 9509420 into fastify:master Oct 4, 2023
@Fdawgs Fdawgs mentioned this pull request Oct 4, 2023
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants