File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 2323 "lint" : " eslint ."
2424 },
2525 "dependencies" : {
26+ "@fastify/rate-limit" : " ^10.3.0" ,
2627 "@fastify/static" : " ^9.0.0" ,
2728 "@fastify/websocket" : " ^11.2.0" ,
2829 "@wdio/cli" : " 9.27.0" ,
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import url from 'node:url'
33
44import Fastify , { type FastifyInstance , type FastifyRequest } from 'fastify'
55import staticServer from '@fastify/static'
6+ import rateLimit from '@fastify/rate-limit'
67import websocket from '@fastify/websocket'
78import getPort from 'get-port'
89import logger from '@wdio/logger'
@@ -54,6 +55,11 @@ export async function start(
5455 const appPath = await getDevtoolsApp ( )
5556
5657 server = Fastify ( { logger : true } )
58+ await server . register ( rateLimit , {
59+ global : false ,
60+ max : 100 ,
61+ timeWindow : '1 minute'
62+ } )
5763 await server . register ( websocket )
5864 await server . register ( staticServer , {
5965 root : appPath
@@ -172,6 +178,14 @@ export async function start(
172178 // requests the file through this endpoint.
173179 server . get (
174180 '/api/video/:sessionId' ,
181+ {
182+ config : {
183+ rateLimit : {
184+ max : 30 ,
185+ timeWindow : '1 minute'
186+ }
187+ }
188+ } ,
175189 async (
176190 request : FastifyRequest < { Params : { sessionId : string } } > ,
177191 reply
You can’t perform that action at this time.
0 commit comments