-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
logLevel option not respected #320
Comments
There is not an instance of logging in this module https://github.com/search?q=repo%3Afastify%2Ffastify-cors%20log&type=code |
This module registers route handler and fastify.get('/', { logLevel: 'warn' }, (request, reply) => {
reply.send({ hello: 'world' })
}) Yet, there is no way to push // The preflight reply must occur in the hook. This allows fastify-cors to reply to
// preflight requests BEFORE possible authentication plugins. If the preflight reply
// occurred in this handler, other plugins may deny the request since the browser will
// remove most headers (such as the Authentication header).
//
// This route simply enables fastify to accept preflight requests.
fastify.options('*', { schema: { hide: hideOptionsRoute } }, (req, reply) => {
if (!req.corsPreflightEnabled) {
// Do not handle preflight requests if the origin option disabled CORS
reply.callNotFound()
return
}
reply.send()
}) |
Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests. |
Prerequisites
Fastify version
4.28.1
Plugin version
9.0.1
Node.js version
18.20.2
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Ubuntu 22.04.4 LTS
Description
It would be nice to exclude OPTIONS requests from the logs
Link to code that reproduces the bug
No response
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: