Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 1 addition & 3 deletions test/ping.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Loading