handle cleanup of trailing /

This commit is contained in:
derrickmehaffy 2023-07-19 01:25:04 -07:00
parent ed364d951a
commit e8231bbca2
2 changed files with 14 additions and 2 deletions

View File

@ -24,7 +24,13 @@ module.exports =
const rateLimit = require('koa2-ratelimit').RateLimit; const rateLimit = require('koa2-ratelimit').RateLimit;
const userEmail = toLower(ctx.request.body.email) || 'unknownEmail'; const userEmail = toLower(ctx.request.body.email) || 'unknownEmail';
const requestPath = toLower(ctx.request.path) || 'unknownPath'; let requestPath = toLower(ctx.request.path) || 'unknownPath';
if (requestPath.endsWith('/')) {
if (requestPath !== '/') {
requestPath = requestPath.slice(0, -1);
}
}
const loadConfig = { const loadConfig = {
interval: { min: 5 }, interval: { min: 5 },

View File

@ -24,7 +24,13 @@ module.exports =
const rateLimit = require('koa2-ratelimit').RateLimit; const rateLimit = require('koa2-ratelimit').RateLimit;
const userIdentifier = toLower(ctx.request.body.email) || 'unknownIdentifier'; const userIdentifier = toLower(ctx.request.body.email) || 'unknownIdentifier';
const requestPath = toLower(ctx.request.path) || 'unknownPath'; let requestPath = toLower(ctx.request.path) || 'unknownPath';
if (requestPath.endsWith('/')) {
if (requestPath !== '/') {
requestPath = requestPath.slice(0, -1);
}
}
const loadConfig = { const loadConfig = {
interval: { min: 5 }, interval: { min: 5 },