Skip to content

Commit

Permalink
fix(auth): allow empty logout endpoint (#1211)
Browse files Browse the repository at this point in the history
  • Loading branch information
nnixaa authored Feb 5, 2019
1 parent 2e44bbc commit 564138d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/framework/auth/strategies/auth-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ export abstract class NbAuthStrategy {
protected getActionEndpoint(action: string): string {
const actionEndpoint: string = this.getOption(`${action}.endpoint`);
const baseEndpoint: string = this.getOption('baseEndpoint');
return baseEndpoint + actionEndpoint;
return actionEndpoint ? baseEndpoint + actionEndpoint : '';
}
}
22 changes: 22 additions & 0 deletions src/framework/auth/strategies/password/password-strategy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,28 @@ describe('password-auth-strategy', () => {
.flush(successResponse);
});

it('logout with no endpoint', (done: DoneFn) => {

strategy.setOptions({
name: ownerStrategyName,
baseEndpoint: '/api/auth/custom/',
logout: {
endpoint: '',
},
});

strategy.logout()
.subscribe((result: NbAuthResult) => {
expect(result).toBeTruthy();
expect(result.isFailure()).toBe(false);
expect(result.isSuccess()).toBe(true);

done();
});

httpMock.expectNone('/api/auth/custom/');
});

it('refreshToken', (done: DoneFn) => {
strategy.refreshToken()
.subscribe((result: NbAuthResult) => {
Expand Down

0 comments on commit 564138d

Please sign in to comment.