Skip to content

Commit 36362ea

Browse files
feat(): add get response method to override res object
1 parent 52df57a commit 36362ea

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/auth.guard.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function createAuthGuard(type?: string | string[]): Type<CanActivate> {
4646
};
4747
const [request, response] = [
4848
this.getRequest(context),
49-
context.switchToHttp().getResponse()
49+
this.getResponse(context)
5050
];
5151
const passportFn = createPassportContext(request, response);
5252
const user = await passportFn(
@@ -63,6 +63,10 @@ function createAuthGuard(type?: string | string[]): Type<CanActivate> {
6363
return context.switchToHttp().getRequest();
6464
}
6565

66+
getResponse<T = any>(context: ExecutionContext): T {
67+
return context.switchToHttp().getResponse();
68+
}
69+
6670
async logIn<TRequest extends { logIn: Function } = any>(
6771
request: TRequest
6872
): Promise<void> {

0 commit comments

Comments
 (0)