Skip to content

Commit

Permalink
Add 10s timeout for form parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
blomqma committed Mar 26, 2024
1 parent 4324280 commit 81e2aa6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/next-rest-framework/src/shared/form-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ export const parseMultiPartFormData = async (req: NextApiRequest) =>
await new Promise<FormData>((resolve, reject) => {
const form = new Formidable();

setTimeout(() => {
reject(new Error('Form parsing timeout.'));
}, 10000);

form.parse(req, (err, fields, files) => {
if (err) {
reject(err);
Expand Down

0 comments on commit 81e2aa6

Please sign in to comment.