Open fjeldstad opened 1 month ago
Created a PR, but I'm not sure if it solves it in the most appropriate way. I thought an early return would be safest + it allows for reducing nesting in the plugin, but I might well have missed something. https://github.com/hapijs/crumb/pull/166
The best workaround I've come up with is to set a custom skip
function that patches the bug (it will result in an early return):
skip: (request, h) => request?.route?.settings?.plugins?.crumb === false,
Runtime
node.js
Runtime version
20
Module version
9.0.1
Last module version without issue
No response
Used with
hapi
Any other relevant information
From the documentation:
This test case verifies the expected behaviour with regards to setting
route.options.plugins.crumb: false
:What are you trying to achieve or the steps to reproduce?
I want to disable crumb validation/generation for a specific route, without using the
skip
option (to keep concerns separated). I therefore setroute.options.plugins.crumb: false
as suggested by the documentation.What was the result you got?
The crumb validation runs and a new cookie value is returned.
What result did you expect?
The crumb validation should not run, no cookie should be set.