Skip to content

Commit

Permalink
fix: add user to FastifyRequest typings (#74) (#75)
Browse files Browse the repository at this point in the history
* fix: add user to FastifyRequest typings (#74)

* tests: add test for user type on request
  • Loading branch information
Philipp Gfeller authored and Eomm committed Dec 5, 2019
1 parent 415f8ae commit 6a7a482
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ declare module 'fastify' {
options: jwt.VerifyOptions,
callback: JWTTypes.VerifyCallback<Decoded>,
): void;
user: JWTTypes.SignPayloadType;
}
}

Expand Down
1 change: 1 addition & 0 deletions type.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ app.post('/signup', async (req, reply) =>
{
const token = app.jwt.sign({ user: "userName" });
let data = await app.jwt.verify(token);
const user = req.user;
reply.send({ token });
});

0 comments on commit 6a7a482

Please sign in to comment.