-
Notifications
You must be signed in to change notification settings - Fork 38
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
rambulance doesn't rescue request with invalid format #41
Comments
Thanks for reporting. The exceptions app already responds to all the methods that correspond to all the error HTTP status codes. What this means is that if there's a template for the status code, it will just work out of the box. Try creating a file called $ echo "Custom error page for 406 Not Acceptable" > app/views/errors/not_acceptable.text.erb You can see all the predefined actions by looking at the
What's actually unexpected, however, is that the exceptions app allowed an internal exception to bubble up when it shouldn't, causing the page to show an almost blank error page. There are a few improvements that could be made:
|
Thanks for the reply.
I'm sorry I didn't make it clear enough. What I think as a problem is that a user can request with any format, like If a user request with unknown format, web service with rambulance should respond 4xx(maybe 406), but respond 500 now.
I totally agree.
I think this is the best out all of them. I think it's better that we can set default format to rambulance. If a user request with a format and a template with the format doesn't exist, rambulance should search template with default format and display it. |
re-opening as this isn't quite fixed yet: https://travis-ci.org/yuki24/rambulance/builds/326901626 |
Hi, is this now fixed? We are experiencing the same issue. |
The master branch should work fine with Rails 5.0 and 5.1. Would you mind using it for now? |
Hi, we use Rails 5.1. I'm using now |
@joker-777 Thanks for getting back, but I'm not sure I understand your issue. Could you post example code or a test that fails? |
OK, when I use the url But when I use Without the layout. Here is the config file we are using. In addition, we still see this ActionController::UnknownFormat error in our logs. It seems it isn't caught properly. |
@joker-777 do you have |
@yuki24 No, we don't. |
Assuming you are using Also, what would you expect to observe? As @willnet mentioned above, there's no good way to cover every single mime type as there's a million of them and falling back to a text/html response is all the framework could do. |
Yes, it returns the correct status number and also uses the correct template but without any layout although it is defined correctly. It also logs an error too. |
@joker-777 It'd be much appreciated if you could provide me with a test case that fails. |
@y-yagi Sorry for my late raply. I finally managed to create this test app. https://github.com/joker-777/rambulance_test_app After starting the server call
Because |
Thanks @joker-777 for the example. I haven't been able to work on my open source stuff lately but will be able to look into this as well as other issues in early March. Thanks again for bearing with me! |
@yuki24 Never mind, I think I found out why it didn't use the correct layout. You set the layout to false when the request is a json request. Also please don't mind my comment about logging the error. It seems like this is normal. |
@yuki24 There is actually another problem. It is possible that a format exists with the ref |
I created a PR for it. #42 |
released as 0.6.0. Thanks for bearing with me! |
a request like
/users.text
raiseActionController::UnknownFormat
when the routes exists but the template with the format doesn't exist.rambulance doesn't rescue the error because not_acceptable.text template also doesn't exist.
I think that rambulance should render not_acceptable.html if client request without formats rambulance handles. but I can not think of a good method to create PR. Please tell me if anyone has a good way.
sample app for reproduce the behavior
willnet/rambulance-format-issue-sample
log sample
The text was updated successfully, but these errors were encountered: