File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -78,9 +78,6 @@ async function handleBatch(router, req) {
7878 if ( ! restRequest || typeof restRequest !== 'object' || typeof restRequest . path !== 'string' ) {
7979 throw new Parse . Error ( Parse . Error . INVALID_JSON , 'batch request path must be a string' ) ;
8080 }
81- if ( restRequest . method === 'POST' && restRequest . path . endsWith ( batchPath ) ) {
82- throw new Parse . Error ( Parse . Error . INVALID_JSON , 'nested batch requests are not allowed' ) ;
83- }
8481 }
8582
8683 // The batch paths are all from the root of our domain.
@@ -104,6 +101,9 @@ async function handleBatch(router, req) {
104101 const rateLimits = req . config . rateLimits || [ ] ;
105102 for ( const restRequest of req . body . requests ) {
106103 const routablePath = makeRoutablePath ( restRequest . path ) ;
104+ if ( ( restRequest . method || 'GET' ) . toUpperCase ( ) === 'POST' && routablePath === batchPath ) {
105+ throw new Parse . Error ( Parse . Error . INVALID_JSON , 'nested batch requests are not allowed' ) ;
106+ }
107107 for ( const limit of rateLimits ) {
108108 const pathExp = limit . path . regexp || limit . path ;
109109 if ( ! pathExp . test ( routablePath ) ) {
You can’t perform that action at this time.
0 commit comments