Return early from middleware
Hello, I want to return a 200 response from a middleware if certain conditions are not met, else run await and cleanup after the await. How can I return early from the middleare function?
2 Replies
So the error I had was unrelated to the return, returning normally early with the response object works!
You also just do
return c.text("Works!")
inside the middleware, this should be before await next()
line. Also if you want to throw an error try using HTTPException