[Bug?]: Status code mismatch and always return 200 when using createMiddleware
#1643
Open
2 tasks done
Labels
bug
Something isn't working
Duplicates
Latest version
Current behavior 😯
Hi, I'm creating a middleware that logs the request and format it to corresponding status range. (example 400 - 499). the
<HttpStatusCode code={404} />
works fine and it resolves to the correct status code.however, in the middleware part. it always return 200
Expected behavior 🤔
it should reflect 404 for both middleware and to the final response. i assume that the problem lies to the middleware itself.
createMiddleware
has two parameters, onRequest and onBeforeResponse. it doesn't catch the final response before sending it the user. i assume this is the normal flow of the request cycle. it doesn't catch any status code that the developer put before sending the final request to the client. correct me if i'm wrong.i found this issue on vinxi that has somewhat the same problem as mine nksaraf/vinxi#182 but haven't fixed yet for months now.
Steps to reproduce 🕹
Steps:
<HttpStatusCode code={404} />
to *404.tsContext 🔦
No response
Your environment 🌎
The text was updated successfully, but these errors were encountered: