Refactor API key validation to use case-insensitive header name
This commit is contained in:
2
index.js
2
index.js
@@ -98,7 +98,7 @@ async function main() {
|
|||||||
|
|
||||||
app.post('/:instanceId', async (req, res) => {
|
app.post('/:instanceId', async (req, res) => {
|
||||||
|
|
||||||
const apikey = req.headers['X-BatchHttp-Api-Key'];
|
const apikey = req.headers['x-batchhttp-api-key'];
|
||||||
if (apikey !== API_KEY) {
|
if (apikey !== API_KEY) {
|
||||||
res.status(401).send({
|
res.status(401).send({
|
||||||
error: "Invalid API Key"
|
error: "Invalid API Key"
|
||||||
|
|||||||
Reference in New Issue
Block a user