You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched existing issues to ensure the bug has not already been reported
Fastify version
5.0.0
Plugin version
8.0.1
Node.js version
20.9.0
Operating system
Windows
Operating system version (i.e. 20.04, 11.3, 10)
11
Description
Sending file with 404 status code dont work, see the code below.
On fastify version 4.28.1 and plugin version this worked normally.
constfastify=require('fastify')({logger: true})constpath=require('node:path')fastify.register(require('@fastify/static'),{root: path.join(__dirname,'public'),prefix: '/',})fastify.setNotFoundHandler((req,reply)=>{returnreply.code(404).type("text/html").sendFile("404.html")// this send the file with 200 status code})// Run the server!fastify.listen({port: 3000})
constfastify=require('fastify')({logger: true})constpath=require('node:path')fastify.register(require('@fastify/static'),{root: path.join(__dirname,'public'),prefix: '/',})fastify.setNotFoundHandler((req,reply)=>{returnreply.code(404).type("text/html").send("Hello world")// this send the Hello world message with 404 status code})// Run the server!fastify.listen({port: 3000})
Link to code that reproduces the bug
No response
Expected Behavior
It should send file with 404 status code.
The text was updated successfully, but these errors were encountered:
Prerequisites
Fastify version
5.0.0
Plugin version
8.0.1
Node.js version
20.9.0
Operating system
Windows
Operating system version (i.e. 20.04, 11.3, 10)
11
Description
Sending file with 404 status code dont work, see the code below.
On fastify version 4.28.1 and plugin version this worked normally.
Link to code that reproduces the bug
No response
Expected Behavior
It should send file with 404 status code.
The text was updated successfully, but these errors were encountered: