Skip to content

Commit

Permalink
Merge pull request #49 from swat-sccs/fix-integration-tests
Browse files Browse the repository at this point in the history
Fix integration tests
  • Loading branch information
RobinsonZ authored Oct 3, 2023
2 parents f7a69c9 + d57ec6b commit 41ffef1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [master]

jobs:
build:
test:
runs-on: ubuntu-latest

steps:
Expand Down
9 changes: 6 additions & 3 deletions src/util/rateLimits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ const postRateLimiter = new RateLimiterMemory({

export const limitRequestRate: RequestHandler = catchErrors(async (req, res, next) => {
try {
const limiter = req.method == 'GET' ? requestRateLimiter : postRateLimiter;
const limiterRes = await limiter.consume(req.ip);
setRateLimitHeaders(limiterRes, res);
// don't ratelimit login because it breaks integration tests and it has its own ratelimiters
if (req.path !== '/login') {
const limiter = req.method == 'GET' ? requestRateLimiter : postRateLimiter;
const limiterRes = await limiter.consume(req.ip);
setRateLimitHeaders(limiterRes, res);
}
next();
} catch (e) {
if (e instanceof Error) {
Expand Down

0 comments on commit 41ffef1

Please sign in to comment.