hono icon indicating copy to clipboard operation
hono copied to clipboard

Using `every` + `except` doesn't work as expected. `4.6.3`

Open Blankeos opened this issue 4 months ago • 1 comments

What version of Hono are you using?

4.6.3

What runtime/platform is your app running on?

Node

What steps can reproduce the bug?

Just this piece of code for the middleware


const middleware = every(
   except(_ => true, // True means it won't run 🛑
   () => {
      console.log("1st middleware ran");
   }),
   except(_ => false, // False means it WILL run ✅
   () => {
      console.log("2nd middleware ran");
   })
);

But the output will still be:

1st middleware ran
2nd middleware ran

I don't understand... Why did 1st middleware run even when its "except" is true?

Also, the only case that the first middleware won't run is when both are true.

What is the expected behavior?

Only 2nd will run, and 1st won't.

What do you see instead?

No response

Additional information

No response

Blankeos avatar Oct 24 '24 21:10 Blankeos