File tree Expand file tree Collapse file tree 3 files changed +25
-4
lines changed Expand file tree Collapse file tree 3 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -345,7 +345,7 @@ describe('rate limit', () => {
345
345
requestCount : 1 ,
346
346
errorResponseMessage : 'Too many requests' ,
347
347
includeInternalRequests : true ,
348
- zone : ' global' ,
348
+ zone : Parse . Server . RateLimitZone . global ,
349
349
} ,
350
350
} ) ;
351
351
const fakeReq = {
@@ -391,7 +391,7 @@ describe('rate limit', () => {
391
391
requestCount : 1 ,
392
392
errorResponseMessage : 'Too many requests' ,
393
393
includeInternalRequests : true ,
394
- zone : ' session' ,
394
+ zone : Parse . Server . RateLimitZone . session ,
395
395
} ,
396
396
} ) ;
397
397
Parse . Cloud . define ( 'test' , ( ) => 'Abc' ) ;
@@ -412,7 +412,7 @@ describe('rate limit', () => {
412
412
requestCount : 1 ,
413
413
errorResponseMessage : 'Too many requests' ,
414
414
includeInternalRequests : true ,
415
- zone : ' user' ,
415
+ zone : Parse . Server . RateLimitZone . user ,
416
416
} ,
417
417
} ) ;
418
418
Parse . Cloud . define ( 'test' , ( ) => 'Abc' ) ;
Original file line number Diff line number Diff line change @@ -438,9 +438,11 @@ class ParseServer {
438
438
439
439
function addParseCloud ( ) {
440
440
const ParseCloud = require ( './cloud-code/Parse.Cloud' ) ;
441
+ const ParseServer = require ( './cloud-code/Parse.Server' ) ;
441
442
Object . defineProperty ( Parse , 'Server' , {
442
443
get ( ) {
443
- return Config . get ( Parse . applicationId ) ;
444
+ const conf = Config . get ( Parse . applicationId ) ;
445
+ return { ...conf , ...ParseServer } ;
444
446
} ,
445
447
set ( newVal ) {
446
448
newVal . appId = Parse . applicationId ;
Original file line number Diff line number Diff line change
1
+ const ParseServer = { } ;
2
+ /**
3
+ * ...
4
+ *
5
+ * @memberof Parse.Server
6
+ * @property {String } global Rate limit based on the number of requests made by all users.
7
+ * @property {String } session Rate limit based on the sessionToken.
8
+ * @property {String } user Rate limit based on the user ID.
9
+ * @property {String } ip Rate limit based on the request ip.
10
+ * ...
11
+ */
12
+ ParseServer . RateLimitZone = Object . freeze ( {
13
+ global : 'global' ,
14
+ session : 'session' ,
15
+ user : 'user' ,
16
+ ip : 'ip' ,
17
+ } ) ;
18
+
19
+ module . exports = ParseServer ;
You can’t perform that action at this time.
0 commit comments