File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
packages/server/src/openapi Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -138,7 +138,11 @@ export async function handleRequest({
138
138
if ( method !== 'GET' ) {
139
139
return { status : 400 , body : { message : 'invalid request method, only GET is supported' } } ;
140
140
}
141
- args = query ?. q ? unmarshal ( query . q as string ) : { } ;
141
+ try {
142
+ args = query ?. q ? unmarshal ( query . q as string ) : { } ;
143
+ } catch {
144
+ return { status : 400 , body : { message : 'query param must contain valid JSON' } } ;
145
+ }
142
146
break ;
143
147
144
148
case 'update' :
@@ -158,7 +162,11 @@ export async function handleRequest({
158
162
if ( method !== 'DELETE' ) {
159
163
return { status : 400 , body : { message : 'invalid request method, only DELETE is supported' } } ;
160
164
}
161
- args = query ?. q ? unmarshal ( query . q as string ) : { } ;
165
+ try {
166
+ args = query ?. q ? unmarshal ( query . q as string ) : { } ;
167
+ } catch {
168
+ return { status : 400 , body : { message : 'query param must contain valid JSON' } } ;
169
+ }
162
170
break ;
163
171
164
172
default :
You can’t perform that action at this time.
0 commit comments