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
after hook prints response status 200 instead of 500 #561
Comments
I'm using 2.4.0 and I always have the value |
I am seeing something similar on 2.4, although I'm wondering if #148 is the real problem in my case. |
Status code sets in Function in |
so then maybe the "after" hook should be called after "renderResponse" |
I'm assuming this is expected behavior? I've run into this problem as well. |
Changing |
I am using the after hook to print the response http status for each API call.
after() {
logger.info("request {} {} returned with status code {}", request.getMethod, request.getRequestURL, response.getStatus.toString)
}
When a method returns an error code with halt, the status code is printed correctly, but when the method return a status code in the last line (without halt), the status code which will be printed will always be 200, regardless of real status returned.
For example:
halt(InternalServerError("DB error")) //this will cause status 500 to be printed in the 'after' hook
InternalServerError("an unknown error occurred") //this will cause status 200 to be printed in the 'after' hook, although 500 is actually returned
scalatra 2.3
The text was updated successfully, but these errors were encountered: