(res: HttpResponse, next: CallableFunction)
| 500 | } |
| 501 | |
| 502 | protected broadcastEventRateLimitingMiddleware(res: HttpResponse, next: CallableFunction): any { |
| 503 | let channels = res.body.channels || [res.body.channel]; |
| 504 | |
| 505 | this.server.rateLimiter.consumeBackendEventPoints(Math.max(channels.length, 1), res.app).then(response => { |
| 506 | if (response.canContinue) { |
| 507 | for (let header in response.headers) { |
| 508 | res.writeHeader(header, '' + response.headers[header]); |
| 509 | } |
| 510 | |
| 511 | return next(null, res); |
| 512 | } |
| 513 | |
| 514 | this.tooManyRequestsResponse(res); |
| 515 | }); |
| 516 | } |
| 517 | |
| 518 | protected broadcastBatchEventsRateLimitingMiddleware(res: HttpResponse, next: CallableFunction): any { |
| 519 | let rateLimiterPoints = res.body.batch.reduce((rateLimiterPoints, event) => { |
nothing calls this directly
no test coverage detected