From de4b7ab48492497b684b14661b928f509f650b39 Mon Sep 17 00:00:00 2001 From: Michael Mitchell Date: Mon, 23 Jan 2023 23:09:17 +1100 Subject: [PATCH] fix: authenticate bulk --- index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/index.js b/index.js index 08cad73..4e8dfd7 100644 --- a/index.js +++ b/index.js @@ -53,6 +53,18 @@ async function handleRequest(event) { request.headers.get('URL'), ) } else { + if (request.headers.get('Authorization') != secret) { + return Response.json( + { + code: '401 Unauthorized', + message: 'Unauthorized.', + }, + { + status: 401, + }, + ) + } + let json try { json = JSON.parse(body)