diff --git a/dist/index.js b/dist/index.js index 81642b4..deb5f98 100644 --- a/dist/index.js +++ b/dist/index.js @@ -49,6 +49,9 @@ app.use(express_1.default.json()); app.use(express_1.default.urlencoded({ extended: true })); const validateSecret = (req, res, next) => { const requestSecret = req.headers['x-api-secret'] || req.body.secret; + if (req.method === 'GET' && req.path === '/') { + next(); + } if (!requestSecret || requestSecret !== API_SECRET) { return res.status(401).json({ error: 'Unauthorized', diff --git a/src/index.ts b/src/index.ts index 6c116f0..8217149 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,6 +19,10 @@ const validateSecret = ( ) => { const requestSecret = req.headers['x-api-secret'] || req.body.secret; + if (req.method === 'GET' && req.path === '/') { + next(); + } + if (!requestSecret || requestSecret !== API_SECRET) { return res.status(401).json({ error: 'Unauthorized', diff --git a/test/ping.integration.test.ts b/test/ping.integration.test.ts index 1c7e268..07441d1 100644 --- a/test/ping.integration.test.ts +++ b/test/ping.integration.test.ts @@ -148,10 +148,8 @@ describe('/ping input parameters', () => { }); describe('/ health check', () => { - const API_SECRET = process.env.API_SECRET || 'default-secret-key'; - it('should return a 200 status', async () => { - const res = await request(app).get('/').set('x-api-secret', API_SECRET); + const res = await request(app).get('/'); expect(res.status).toBe(200); expect(res.body.status).toBe('OK'); expect(res.body.supportedChains).toContain('Solana');