mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-06 15:03:08 -05:00
fix(api): handle requests with empty body (user/submit-survey) (#52270)
This commit is contained in:
committed by
GitHub
parent
f3749ab7ec
commit
f844dd2f51
@@ -4,9 +4,10 @@ const log = debugFactory('fcc:boot:user');
|
||||
const allowedTitles = ['Foundational C# with Microsoft Survey'];
|
||||
|
||||
export function validateSurvey(req, res, next) {
|
||||
const {
|
||||
surveyResults: { title = '', responses = [] }
|
||||
} = req.body;
|
||||
const { title, responses } = req.body.surveyResults || {
|
||||
title: '',
|
||||
responses: []
|
||||
};
|
||||
|
||||
if (
|
||||
!allowedTitles.includes(title) ||
|
||||
|
||||
Reference in New Issue
Block a user