Merge pull request #24571 from nickp10/master

Add missing jwt function on the express response object for the jwt-express package
This commit is contained in:
Nathan Shively-Sanders
2018-03-27 15:29:14 -07:00
committed by GitHub
2 changed files with 13 additions and 0 deletions
+11
View File
@@ -218,5 +218,16 @@ declare global {
interface Request {
jwt: JWT;
}
interface Response {
/**
* Returns a newly created / signed JWT Object from the payload. If you are using cookies,
* it will automatically store the JWT in the cookie as well.
*
* @param payload The payload of the JWT
* @return The newly created JWT
*/
jwt(payload: any): JWT;
}
}
}
+2
View File
@@ -39,6 +39,7 @@ app.use((err: jwt.JWTExpressError, req: exp.Request, res: exp.Response, next: ex
jwtObj = req.jwt;
req.jwt.payload;
req.hostname.startsWith("");
jwtObj = res.jwt({ });
});
jwtObj.expired.valueOf();
@@ -60,4 +61,5 @@ app.get("", (req: exp.Request, res: exp.Response, next: exp.NextFunction) => {
jwtObj = req.jwt;
req.jwt.payload;
req.hostname.startsWith("");
jwtObj = res.jwt({ });
});