@@ -967,6 +967,36 @@ describe('rate limit', () => {
967967 } ) ;
968968 } ) ;
969969
970+ it ( 'should enforce rate limit when _method override uses non-standard casing' , async ( ) => {
971+ Parse . Cloud . beforeLogin ( ( ) => { } , {
972+ rateLimit : {
973+ requestTimeWindow : 10000 ,
974+ requestCount : 1 ,
975+ errorResponseMessage : 'Too many requests' ,
976+ includeInternalRequests : true ,
977+ } ,
978+ } ) ;
979+ await Parse . User . signUp ( 'testuser' , 'password' ) ;
980+ const res1 = await request ( {
981+ method : 'POST' ,
982+ headers,
983+ url : 'http://localhost:8378/1/login' ,
984+ body : JSON . stringify ( { username : 'testuser' , password : 'password' } ) ,
985+ } ) ;
986+ expect ( res1 . data . username ) . toBe ( 'testuser' ) ;
987+ // Second login via POST with _method:'get' (lowercase) — should still be rate limited
988+ const res2 = await request ( {
989+ method : 'POST' ,
990+ headers,
991+ url : 'http://localhost:8378/1/login' ,
992+ body : JSON . stringify ( { _method : 'get' , username : 'testuser' , password : 'password' } ) ,
993+ } ) . catch ( e => e ) ;
994+ expect ( res2 . data ) . toEqual ( {
995+ code : Parse . Error . CONNECTION_FAILED ,
996+ error : 'Too many requests' ,
997+ } ) ;
998+ } ) ;
999+
9701000 it ( 'should ignore _method override with non-string type' , async ( ) => {
9711001 await reconfigureServer ( {
9721002 rateLimit : [
0 commit comments