Skip to content

Commit

Permalink
fix: Skip API guarding for .js files
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Nikitin committed Jun 9, 2023
1 parent 9f8f45b commit a299e86
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class MethodToScope {
export class ApiGuarding {
private routeToScoupe: MethodToScope[] = []
private static pathSkip = ['/', '/swagger', '/user']
private static regExpSkip = new RegExp("^/.*js")
constructor() {
this.registerRoute('/account', 'GET', 'account:read')
this.registerRoute('/account', 'POST', 'account:create')
Expand Down Expand Up @@ -165,7 +166,7 @@ export class ApiGuarding {
}

public skipPath(path: string): boolean {
return ApiGuarding.pathSkip.includes(path)
return ApiGuarding.pathSkip.includes(path) || path.match(ApiGuarding.regExpSkip) !== null
}
}

Expand Down

0 comments on commit a299e86

Please sign in to comment.