@@ -462,11 +462,11 @@ test('register /static and /static2', async (t) => {
462462 const fastify = Fastify ( )
463463 fastify . register ( fastifyStatic , pluginOptions )
464464
465- fastify . get ( '/foo' , ( req , rep ) => {
465+ fastify . get ( '/foo' , ( _req , rep ) => {
466466 rep . sendFile ( 'foo.html' )
467467 } )
468468
469- fastify . get ( '/bar' , ( req , rep ) => {
469+ fastify . get ( '/bar' , ( _req , rep ) => {
470470 rep . sendFile ( 'bar.html' )
471471 } )
472472
@@ -575,7 +575,7 @@ test('payload.path is set', async (t) => {
575575 const fastify = Fastify ( )
576576 let gotFilename
577577 fastify . register ( fastifyStatic , pluginOptions )
578- fastify . addHook ( 'onSend' , function ( req , reply , payload , next ) {
578+ fastify . addHook ( 'onSend' , function ( _req , _reply , payload , next ) {
579579 gotFilename = payload . path
580580 next ( )
581581 } )
@@ -617,7 +617,7 @@ test('error responses can be customized with fastify.setErrorHandler()', async t
617617 }
618618 const fastify = Fastify ( )
619619
620- fastify . setErrorHandler ( function errorHandler ( err , request , reply ) {
620+ fastify . setErrorHandler ( function errorHandler ( err , _request , reply ) {
621621 reply . code ( 403 ) . type ( 'text/plain' ) . send ( `${ err . statusCode } Custom error message` )
622622 } )
623623
@@ -724,7 +724,7 @@ test('serving disabled', async (t) => {
724724
725725 t . after ( ( ) => fastify . close ( ) )
726726
727- fastify . get ( '/foo/bar' , ( request , reply ) => {
727+ fastify . get ( '/foo/bar' , ( _request , reply ) => {
728728 reply . sendFile ( 'index.html' )
729729 } )
730730
@@ -766,18 +766,18 @@ test('sendFile', async (t) => {
766766
767767 t . after ( ( ) => fastify . close ( ) )
768768
769- fastify . get ( '/foo/bar' , function ( req , reply ) {
769+ fastify . get ( '/foo/bar' , function ( _req , reply ) {
770770 reply . sendFile ( '/index.html' )
771771 } )
772772
773- fastify . get ( '/root/path/override/test' , ( request , reply ) => {
773+ fastify . get ( '/root/path/override/test' , ( _request , reply ) => {
774774 reply . sendFile (
775775 '/foo.html' ,
776776 path . join ( __dirname , 'static' , 'deep' , 'path' , 'for' , 'test' , 'purpose' )
777777 )
778778 } )
779779
780- fastify . get ( '/foo/bar/options/override/test' , function ( req , reply ) {
780+ fastify . get ( '/foo/bar/options/override/test' , function ( _req , reply ) {
781781 reply . sendFile ( '/index.html' , { maxAge } )
782782 } )
783783
@@ -838,7 +838,7 @@ test('sendFile disabled', async (t) => {
838838
839839 t . after ( ( ) => fastify . close ( ) )
840840
841- fastify . get ( '/foo/bar' , function ( req , reply ) {
841+ fastify . get ( '/foo/bar' , function ( _req , reply ) {
842842 if ( reply . sendFile === undefined ) {
843843 reply . send ( 'pass' )
844844 } else {
@@ -898,7 +898,7 @@ test('allowedPath option - request', async (t) => {
898898
899899 const pluginOptions = {
900900 root : path . join ( __dirname , '/static' ) ,
901- allowedPath : ( pathName , root , request ) => request . query . key === 'temporaryKey'
901+ allowedPath : ( _pathName , _root , request ) => request . query . key === 'temporaryKey'
902902 }
903903 const fastify = Fastify ( )
904904 fastify . register ( fastifyStatic , pluginOptions )
@@ -939,26 +939,26 @@ test('download', async (t) => {
939939
940940 t . after ( ( ) => fastify . close ( ) )
941941
942- fastify . get ( '/foo/bar' , function ( req , reply ) {
942+ fastify . get ( '/foo/bar' , function ( _req , reply ) {
943943 reply . download ( '/index.html' )
944944 } )
945945
946- fastify . get ( '/foo/bar/change' , function ( req , reply ) {
946+ fastify . get ( '/foo/bar/change' , function ( _req , reply ) {
947947 reply . download ( '/index.html' , 'hello-world.html' )
948948 } )
949949
950- fastify . get ( '/foo/bar/override' , function ( req , reply ) {
950+ fastify . get ( '/foo/bar/override' , function ( _req , reply ) {
951951 reply . download ( '/index.html' , 'hello-world.html' , {
952952 maxAge : '2 hours' ,
953953 immutable : true
954954 } )
955955 } )
956956
957- fastify . get ( '/foo/bar/override/2' , function ( req , reply ) {
957+ fastify . get ( '/foo/bar/override/2' , function ( _req , reply ) {
958958 reply . download ( '/index.html' , { acceptRanges : false } )
959959 } )
960960
961- fastify . get ( '/root/path/override/test' , ( request , reply ) => {
961+ fastify . get ( '/root/path/override/test' , ( _request , reply ) => {
962962 reply . download ( '/foo.html' , {
963963 root : path . join (
964964 __dirname ,
@@ -972,7 +972,7 @@ test('download', async (t) => {
972972 } )
973973 } )
974974
975- fastify . get ( '/root/path/override/test/change' , ( request , reply ) => {
975+ fastify . get ( '/root/path/override/test/change' , ( _request , reply ) => {
976976 reply . download ( '/foo.html' , 'hello-world.html' , {
977977 root : path . join (
978978 __dirname ,
@@ -1070,7 +1070,7 @@ test('download disabled', async (t) => {
10701070 const fastify = Fastify ( )
10711071 fastify . register ( fastifyStatic , pluginOptions )
10721072
1073- fastify . get ( '/foo/bar' , function ( req , reply ) {
1073+ fastify . get ( '/foo/bar' , function ( _req , reply ) {
10741074 if ( reply . download === undefined ) {
10751075 t . assert . deepStrictEqual ( reply . download , undefined )
10761076 reply . send ( 'pass' )
@@ -1141,7 +1141,7 @@ test('send options', (t) => {
11411141 const fastify = Fastify ( { logger : false } )
11421142 const { resolve, promise } = Promise . withResolvers ( )
11431143 const fastifyStatic = require ( 'proxyquire' ) ( '../' , {
1144- '@fastify/send' : function sendStub ( req , pathName , options ) {
1144+ '@fastify/send' : function sendStub ( _req , pathName , options ) {
11451145 t . assert . deepStrictEqual ( pathName , '/index.html' )
11461146 t . assert . deepStrictEqual ( options . root , path . join ( __dirname , '/static' ) )
11471147 t . assert . deepStrictEqual ( options . acceptRanges , 'acceptRanges' )
@@ -1306,7 +1306,7 @@ test('register no prefix', async (t) => {
13061306 const fastify = Fastify ( )
13071307 fastify . register ( fastifyStatic , pluginOptions )
13081308
1309- fastify . get ( '/' , ( request , reply ) => {
1309+ fastify . get ( '/' , ( _request , reply ) => {
13101310 reply . send ( { hello : 'world' } )
13111311 } )
13121312
@@ -1559,7 +1559,7 @@ test('register with wildcard false', async t => {
15591559 const fastify = Fastify ( )
15601560 fastify . register ( fastifyStatic , pluginOptions )
15611561
1562- fastify . get ( '/*' , ( request , reply ) => {
1562+ fastify . get ( '/*' , ( _request , reply ) => {
15631563 reply . send ( { hello : 'world' } )
15641564 } )
15651565
@@ -1661,7 +1661,7 @@ test('register with wildcard false (trailing slash in the root)', async t => {
16611661 } )
16621662 fastify . register ( fastifyStatic , pluginOptions )
16631663
1664- fastify . get ( '/*' , ( request , reply ) => {
1664+ fastify . get ( '/*' , ( _request , reply ) => {
16651665 reply . send ( { hello : 'world' } )
16661666 } )
16671667
@@ -1729,7 +1729,7 @@ test('register with wildcard string', async (t) => {
17291729 const fastify = Fastify ( )
17301730 fastify . register ( fastifyStatic , pluginOptions )
17311731
1732- fastify . get ( '/*' , ( request , reply ) => {
1732+ fastify . get ( '/*' , ( _request , reply ) => {
17331733 reply . send ( { hello : 'world' } )
17341734 } )
17351735
@@ -1746,7 +1746,7 @@ test('register with wildcard string on multiple root paths', async (t) => {
17461746 const fastify = Fastify ( )
17471747 fastify . register ( fastifyStatic , pluginOptions )
17481748
1749- fastify . get ( '/*' , ( request , reply ) => {
1749+ fastify . get ( '/*' , ( _request , reply ) => {
17501750 reply . send ( { hello : 'world' } )
17511751 } )
17521752
@@ -1766,7 +1766,7 @@ test('register with wildcard false and alternative index', async t => {
17661766 const fastify = Fastify ( )
17671767 fastify . register ( fastifyStatic , pluginOptions )
17681768
1769- fastify . get ( '/*' , ( request , reply ) => {
1769+ fastify . get ( '/*' , ( _request , reply ) => {
17701770 reply . send ( { hello : 'world' } )
17711771 } )
17721772
@@ -1890,7 +1890,7 @@ test('register /static with wildcard false and alternative index', async t => {
18901890 const fastify = Fastify ( )
18911891 fastify . register ( fastifyStatic , pluginOptions )
18921892
1893- fastify . get ( '/*' , ( request , reply ) => {
1893+ fastify . get ( '/*' , ( _request , reply ) => {
18941894 reply . send ( { hello : 'world' } )
18951895 } )
18961896
@@ -2389,7 +2389,7 @@ test('if dotfiles are properly served according to plugin options', async (t) =>
23892389
23902390test ( 'register with failing glob handler' , async ( t ) => {
23912391 const fastifyStatic = proxyquire . noCallThru ( ) ( '../' , {
2392- glob : function globStub ( pattern , options , cb ) {
2392+ glob : function globStub ( _pattern , _options , cb ) {
23932393 process . nextTick ( function ( ) {
23942394 return cb ( new Error ( 'mock glob error' ) )
23952395 } )
@@ -2414,7 +2414,7 @@ test(
24142414 async ( t ) => {
24152415 const fastifyStatic = proxyquire ( '../' , {
24162416 'node:fs' : {
2417- statSync : function statSyncStub ( path ) {
2417+ statSync : function statSyncStub ( ) {
24182418 throw new Error ( { code : 'MOCK' } )
24192419 }
24202420 }
@@ -2463,7 +2463,7 @@ test('routes should use custom errorHandler premature stream close', async t =>
24632463 fastify . addHook ( 'onRoute' , function ( routeOptions ) {
24642464 t . assert . ok ( routeOptions . errorHandler instanceof Function )
24652465
2466- routeOptions . onRequest = ( request , reply , done ) => {
2466+ routeOptions . onRequest = ( _request , _reply , done ) => {
24672467 const fakeError = new Error ( )
24682468 fakeError . code = 'ERR_STREAM_PREMATURE_CLOSE'
24692469 done ( fakeError )
@@ -2489,7 +2489,7 @@ test('routes should fallback to default errorHandler', async t => {
24892489 fastify . addHook ( 'onRoute' , function ( routeOptions ) {
24902490 t . assert . ok ( routeOptions . errorHandler instanceof Function )
24912491
2492- routeOptions . preHandler = ( request , reply , done ) => {
2492+ routeOptions . preHandler = ( _request , _reply , done ) => {
24932493 const fakeError = new Error ( )
24942494 fakeError . code = 'SOMETHING_ELSE'
24952495 done ( fakeError )
0 commit comments