Skip to content

Commit 3a2c5fe

Browse files
dominique-pfistertripodsan
authored andcommitted
fix: missing config/support should not be treated as 500 (#694)
1 parent 477b0ca commit 3a2c5fe

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/steps/validate-captcha.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ export default async function validateCaptcha(state, body) {
5555
// Check captcha type is correctly configured
5656
const validator = SUPPORTED_CAPTCHA_TYPES[captcha.type];
5757
if (!validator) {
58-
throw new PipelineStatusError(500, `The captcha type ${captcha.type} is not supported.`);
58+
throw new PipelineStatusError(400, `The captcha type ${captcha.type} is not supported.`);
5959
}
6060
if (!captcha.secret) {
61-
throw new PipelineStatusError(500, 'Captcha secret key is not configured.');
61+
throw new PipelineStatusError(400, 'Captcha secret key is not configured.');
6262
}
6363

6464
// Perform validation

test/steps/validate-captcha.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe('Captcha verification', () => {
3838
}, {});
3939
};
4040

41-
await assert.rejects(validate, { code: 500, message: 'The captcha type reCaptcha v3 is not supported.' });
41+
await assert.rejects(validate, { code: 400, message: 'The captcha type reCaptcha v3 is not supported.' });
4242
});
4343

4444
it('returns unsuccessful state with no captcha secret configured', async () => {
@@ -52,7 +52,7 @@ describe('Captcha verification', () => {
5252
}, {});
5353
};
5454

55-
await assert.rejects(validate, { code: 500, message: 'Captcha secret key is not configured.' });
55+
await assert.rejects(validate, { code: 400, message: 'Captcha secret key is not configured.' });
5656
});
5757

5858
it('returns unsuccessful state if recaptcha response is missing from array body', async () => {

0 commit comments

Comments
 (0)