myheats

Live heats, scoring and leaderboard for sport events
git clone https://git.in0rdr.ch/myheats.git
Log | Files | Refs | Pull requests | README | LICENSE

commit bc29d4fea780280bb63568471b2c6d437c73c5f4
parent 2ddf1c765f715c727b6ddc70b8ad613c8629f991
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date:   Sat, 28 Sep 2024 09:36:34 +0200

fix: error routing on get requests

Diffstat:
Msrc/api/server.cjs | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/api/server.cjs b/src/api/server.cjs @@ -170,6 +170,14 @@ server.on('request', async (req, res) => { } catch(error) { serverError(res, error); } + } else { + const pathExists = paths.find((i) => i === url.pathname); + if (pathExists) { + // wrong method for this path + notAllowed(res, req.method); + } else { + notFound(res, url.pathname); + } } } else if (req.method === 'POST') { if (url.pathname === '/v1/echo') {