aboutsummaryrefslogtreecommitdiff
path: root/build/index.js
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2021-03-01 15:10:51 -0600
committermat <27899617+mat-1@users.noreply.github.com>2021-03-01 15:10:51 -0600
commit965a9852acf939b4da3c418b31fdc4c117efb004 (patch)
tree18dc7318694e0dd0d3a09f736437b3a4ee474c4a /build/index.js
parentd00f71b611fd26216bf379df265e53493a1adcb3 (diff)
downloadskyblock-api-965a9852acf939b4da3c418b31fdc4c117efb004.tar.gz
skyblock-api-965a9852acf939b4da3c418b31fdc4c117efb004.tar.bz2
skyblock-api-965a9852acf939b4da3c418b31fdc4c117efb004.zip
send 401 status code when unauthorized
Diffstat (limited to 'build/index.js')
-rw-r--r--build/index.js3
1 files changed, 1 insertions, 2 deletions
diff --git a/build/index.js b/build/index.js
index e6d0ff3..11b2fc6 100644
--- a/build/index.js
+++ b/build/index.js
@@ -12,8 +12,7 @@ exports.debug = false;
app.use((req, res, next) => {
if (process.env.key && req.headers.key !== process.env.key)
// if a key is set in process.env and the header doesn't match return an error
- // TODO: make this have a status code
- return res.json({ error: 'Key in header must match key in env' });
+ return res.status(401).json({ error: 'Key in header must match key in env' });
next();
});
app.get('/', async (req, res) => {