@@ -25,6 +25,7 @@ app.get('/websockets-via-inferrence', { websocket: true }, async function (conne
2525 expectType < SocketStream > ( connection ) ;
2626 expectType < Server > ( app . websocketServer ) ;
2727 expectType < FastifyRequest < RequestGenericInterface > > ( request )
28+ expectType < boolean > ( request . ws ) ;
2829} ) ;
2930
3031const handler : WebsocketHandler = async ( connection , request ) => {
@@ -38,6 +39,7 @@ app.get('/websockets-via-annotated-const', { websocket: true }, handler);
3839app . get ( '/not-specifed' , async ( request , reply ) => {
3940 expectType < FastifyRequest > ( request ) ;
4041 expectType < FastifyReply > ( reply )
42+ expectType < boolean > ( request . ws ) ;
4143} ) ;
4244
4345app . get ( '/not-websockets' , { websocket : false } , async ( request , reply ) => {
@@ -51,10 +53,12 @@ app.route({
5153 handler : ( request , reply ) => {
5254 expectType < FastifyRequest > ( request ) ;
5355 expectType < FastifyReply > ( reply ) ;
56+ expectType < boolean > ( request . ws ) ;
5457 } ,
5558 wsHandler : ( connection , request ) => {
5659 expectType < SocketStream > ( connection ) ;
5760 expectType < FastifyRequest < RouteGenericInterface > > ( request ) ;
61+ expectType < boolean > ( request . ws ) ;
5862 } ,
5963} ) ;
6064
0 commit comments