Enforce method

This commit is contained in:
shamoon 2024-06-03 12:03:10 -07:00
parent 67a9f4983c
commit 19c3ac0d7e
5 changed files with 52 additions and 15 deletions

View file

@ -41,6 +41,11 @@ export default async function handler(req, res) {
const endpoint = mapping?.endpoint;
const endpointProxy = mapping?.proxyHandler || serviceProxyHandler;
if (mapping.method && mapping.method !== req.method) {
logger.debug("Unsupported method: %s", req.method);
return res.status(403).json({ error: "Unsupported method" });
}
if (!endpoint) {
logger.debug("Unsupported service endpoint: %s", type);
return res.status(403).json({ error: "Unsupported service endpoint" });