-
-
Notifications
You must be signed in to change notification settings - Fork 389
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
Change return codes to new Responders defaults #918
Change return codes to new Responders defaults #918
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #918 +/- ##
=======================================
Coverage 98.91% 98.92%
=======================================
Files 14 14
Lines 555 557 +2
=======================================
+ Hits 549 551 +2
Misses 6 6 ☔ View full report in Codecov by Sentry. |
As per https://github.com/heartcombo/responders?tab=readme-ov-file#configuring-error-and-redirect-statuses, newly generated application responders default to self.error_status = :unprocessable_entity
self.redirect_status = :see_other (and also include So it may have sense to change those fields, regardless of Turbo support, and release a major version |
5c6b992
to
4486c67
Compare
4486c67
to
94ee97a
Compare
94ee97a
to
3868d00
Compare
3868d00
to
c7df3eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please retest this without the Responders::HttpCacheResponder
inclusion? When retesting, can you please make sure that forms for both new/create and edit/update, work as expected? Both success and failure scenarios. I just want to make sure there isn't any regressions there for ActiveAdmin. I don't believe there would be.
211035f
to
f4eabf5
Compare
Updated with a ref to a9fb8e1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for including the reference. It makes sense why it was changed. Referencing the "why" is always helpful so I appreciate it.
How did retesting this go with ActiveAdmin? I'd like to ensure that submitting forms, both successful and with validation errors, works as expected. Essentially, no regressions.
Do you think we should release this in a major version? ActiveAdmin is locked to v1.x for InheritedResources so earlier version won't be able to use it so releasing a major version of this is safe. We could permit it in ActiveAdmin v4 though since it's still beta.
According to my tests in the default test app, there are no visible changes. I will run active admin specs against this branch
It is a potential breaking change with some custom javascript expecting a 200 from the server, so in any case it makes sense to release in a major version
Probably it is a good choice |
f4eabf5
to
70abc8f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Let's release as v2 then.
a239d91
to
cd6c395
Compare
Update responder class to the current defaults for responder gem. `HttpCacheResponder` was deliberately excluded in version 1.8.0 Close: activeadmin#862 Ref: - heartcombo/responders#240 - a9fb8e1
cd6c395
to
bf8be73
Compare
@javierjulio rebased
|
@tagliala awesome thanks. I think this is safe as a major release, no beta release needed. You are welcome to bump the major version here or in another PR, I'm fine with either. Thank you. |
Change default error and redirect status codes
Update responder class to the current defaults for responder gem
Close: #862
Ref: heartcombo/responders#240
Supersedes #863
I'm doing some tests with this branch and
$ bin/rake local server
with Active Admin mainRails by default returns
302
on successful create and update, and303
only on destroy. However, according to HTTP/1.1 standard, it appears that303
is the correct status code to redirect from aPOST/PATCH/PUT/DELETE
to aGET
and clients do treat302
like a303
, by usingGET
instead of using the original methodReferences that motivate the decision:
Add
redirect_code_for_unsafe_http_methods
config rails/rails#45393Clarification on redirect status code (303) hotwired/turbo#84
https://github.com/heartcombo/responders?tab=readme-ov-file#configuring-error-and-redirect-statuses
https://en.wikipedia.org/wiki/HTTP_302
(emphasis mine)
https://datatracker.ietf.org/doc/html/rfc2616#section-10.3.4
(emphasis mine)
Default responder created by
rails g responders:install
: https://github.com/heartcombo/responders/blob/9bdc60dfbfa8001641c1c4df7bc73c3fc2a4cf41/lib/generators/responders/install_generator.rb#L10-L25