Closed
Description
I want to use the onResponse
hook to print a log message every time a response is generated. Right now I am reading the value of set.status
to determine the HTTP status code of the response. However in cases where Elysia responds early due to an error, the value of set.status
is incorrect. For example if body validation fails, the server responds to the client with code 400 but the value of set.status
is 500.
Is this the wrong way of determining info about the response? I did not see any other way in the docs or function signature. From what I can tell, the response itself isn't actually accessible in the onResponse
hook.
Metadata
Metadata
Assignees
Labels
No labels