allow case sensitive routing (#43)

This commit is contained in:
Dustin Decker 2023-02-06 09:36:28 -08:00 committed by GitHub
parent b4053b93d0
commit 1e0ee57543
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

17
app.js
View file

@ -85,22 +85,7 @@ async function get_app_server() {
// I have a question for Express: // I have a question for Express:
// https://youtu.be/ZtjFsQBuJWw?t=4 // https://youtu.be/ZtjFsQBuJWw?t=4
app.set('case sensitive routing', true); app.set('case sensitive routing', true);
// Making 100% sure this works like it should
// https://youtu.be/aCbfMkh940Q?t=6
app.use(async function(req, res, next) {
if(req.path.toLowerCase() === req.path) {
next();
return
}
res.status(401).json({
"success": false,
"error": "No.",
"code": "WHY_ARE_YOU_SHOUTING"
}).end();
});
app.use(bodyParser.json()); app.use(bodyParser.json());
// Set security-related headers on requests // Set security-related headers on requests