Skip to content

Commit

Permalink
Define body size limit in all contact form endpoints as spread of imp…
Browse files Browse the repository at this point in the history
…orted config is not supported by NEXT.
  • Loading branch information
jonasbrunvoll committed Jan 16, 2025
1 parent b10b7f3 commit ec585e4
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
7 changes: 0 additions & 7 deletions src/pages/api/contact/contact-api-config.ts

This file was deleted.

7 changes: 5 additions & 2 deletions src/pages/api/contact/means-of-transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import { tryResult } from '@atb/modules/api-server';
import { handlerWithContactFormClient } from '@atb/page-modules/contact/server';
import { ContactApiReturnType } from '@atb/page-modules/contact/server/types';
import { NextApiRequest, NextApiResponse } from 'next';
import { defaultConfig } from './contact-api-config';

export const config = {
...defaultConfig,
api: {
bodyParser: {
sizeLimit: '50mb',
},
},
};

export default handlerWithContactFormClient<ContactApiReturnType>({
Expand Down
7 changes: 5 additions & 2 deletions src/pages/api/contact/refund.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import { tryResult } from '@atb/modules/api-server';
import { handlerWithContactFormClient } from '@atb/page-modules/contact/server';
import { ContactApiReturnType } from '@atb/page-modules/contact/server/types';
import { NextApiRequest, NextApiResponse } from 'next';
import { defaultConfig } from './contact-api-config';

export const config = {
...defaultConfig,
api: {
bodyParser: {
sizeLimit: '50mb',
},
},
};

export default handlerWithContactFormClient<ContactApiReturnType>({
Expand Down
7 changes: 5 additions & 2 deletions src/pages/api/contact/ticket-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import { tryResult } from '@atb/modules/api-server';
import { handlerWithContactFormClient } from '@atb/page-modules/contact/server';
import { ContactApiReturnType } from '@atb/page-modules/contact/server/types';
import { NextApiRequest, NextApiResponse } from 'next';
import { defaultConfig } from './contact-api-config';

export const config = {
...defaultConfig,
api: {
bodyParser: {
sizeLimit: '50mb',
},
},
};

export default handlerWithContactFormClient<ContactApiReturnType>({
Expand Down
8 changes: 5 additions & 3 deletions src/pages/api/contact/ticketing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import { tryResult } from '@atb/modules/api-server';
import { handlerWithContactFormClient } from '@atb/page-modules/contact/server';
import { ContactApiReturnType } from '@atb/page-modules/contact/server/types';
import { NextApiRequest, NextApiResponse } from 'next';
import { defaultConfig } from './contact-api-config';

export const config = {
...defaultConfig,
api: {
bodyParser: {
sizeLimit: '50mb',
},
},
};

export default handlerWithContactFormClient<ContactApiReturnType>({
async POST(req: NextApiRequest, res: NextApiResponse, { client, ok }) {
return tryResult(req, res, async () => {
Expand Down

0 comments on commit ec585e4

Please sign in to comment.