Skip to content
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

Undefined is a valid value for if set as a single hook #4351

Merged
merged 1 commit into from Oct 17, 2022

Conversation

mcollina
Copy link
Member

Unfortunately #4332 was too restrictive and it broke quite a few of our modules, e.g. https://github.com/fastify/fastify-http-proxy/blob/72703f28db516652fdd0fd08f17e269f8947b6b3/index.js#L221 has the value as undefined. This makes it less restrictive by allowing undefined as a value for single-level hooks.

Given that the case mentioned in #4320 was about arrays I think it's ok to land this.

Checklist

Signed-off-by: Matteo Collina <hello@matteocollina.com>
@mcollina mcollina merged commit 602dc08 into main Oct 17, 2022
@mcollina mcollina deleted the undefined-is-ok-for-hooks branch October 17, 2022 14:59
async handler () {
return 'hello world'
}
})
}, new Error('onRequest hook should be a function, instead got undefined'))
}, new Error('onRequest hook should be a function, instead got object'))
Copy link
Member

@SimenB SimenB Oct 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead got object is weird - better to check for null and print that? or util.inspect perhaps

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants