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

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

Open
Blankeos opened this issue Oct 24, 2024 · 1 comment
Open

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

Blankeos opened this issue Oct 24, 2024 · 1 comment
Labels

Comments

@Blankeos
Copy link

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

@usualoma
Copy link
Member

Hi @Blankeos, Thank you for your report.

When I ran the application on my computer using your code snippet, only the 2nd one was executed as expected, so I could not confirm the problem.

Can you provide a complete application code example that allows us to confirm the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants