fix(rate limits): Configuring rate limits with env vars

This commit is contained in:
Chris Troutner
2021-01-07 09:11:35 -08:00
parent ab4c80b674
commit 61485dfe99
4 changed files with 34 additions and 12 deletions
+24
View File
@@ -445,6 +445,30 @@ describe('#route-ratelimits & jwt-auth', () => {
assert.equal(res.locals.pointsToConsume, 50)
})
})
describe('#isInWhitelist', () => {
it('should return false when no argument is passed in', () => {
const result = rateLimits.isInWhitelist()
assert.equal(result, false)
})
it('should return false when origin is not in the whitelist', () => {
const origin = 'blah.com'
const result = rateLimits.isInWhitelist(origin)
assert.equal(result, false)
})
it('should return true when origin is in the whitelist', () => {
const origin = 'message.fullstack.cash'
const result = rateLimits.isInWhitelist(origin)
assert.equal(result, true)
})
})
})
// Generates a Basic authorization header.