File tree Expand file tree Collapse file tree
apps/sim/app/api/tools/jsm/forms Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -83,7 +83,8 @@ export async function POST(request: NextRequest) {
8383 )
8484 }
8585
86- const data = await response . json ( )
86+ const bodyText = await response . text ( )
87+ const data = bodyText ? JSON . parse ( bodyText ) : { }
8788
8889 return NextResponse . json ( {
8990 success : true ,
Original file line number Diff line number Diff line change @@ -83,7 +83,8 @@ export async function POST(request: NextRequest) {
8383 )
8484 }
8585
86- const data = await response . json ( )
86+ const bodyText = await response . text ( )
87+ const data = bodyText ? JSON . parse ( bodyText ) : { }
8788
8889 return NextResponse . json ( {
8990 success : true ,
Original file line number Diff line number Diff line change @@ -83,7 +83,8 @@ export async function POST(request: NextRequest) {
8383 )
8484 }
8585
86- const data = await response . json ( )
86+ const bodyText = await response . text ( )
87+ const data = bodyText ? JSON . parse ( bodyText ) : { }
8788
8889 return NextResponse . json ( {
8990 success : true ,
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ export async function POST(request: NextRequest) {
3939 return NextResponse . json ( { error : 'Form ID is required' } , { status : 400 } )
4040 }
4141
42- if ( ! answers || typeof answers !== 'object' ) {
42+ if ( ! answers || typeof answers !== 'object' || Array . isArray ( answers ) ) {
4343 logger . error ( 'Missing or invalid answers in request' )
4444 return NextResponse . json ( { error : 'Answers object is required' } , { status : 400 } )
4545 }
Original file line number Diff line number Diff line change @@ -83,7 +83,8 @@ export async function POST(request: NextRequest) {
8383 )
8484 }
8585
86- const data = await response . json ( )
86+ const bodyText = await response . text ( )
87+ const data = bodyText ? JSON . parse ( bodyText ) : { }
8788
8889 return NextResponse . json ( {
8990 success : true ,
You can’t perform that action at this time.
0 commit comments