-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
Rework CableReady's ActionController::Renderers
#260
Merged
marcoroth
merged 5 commits into
main
from
deprecate-operations-action-controller-renderer
Mar 10, 2023
Merged
Rework CableReady's ActionController::Renderers
#260
marcoroth
merged 5 commits into
main
from
deprecate-operations-action-controller-renderer
Mar 10, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✅ Deploy Preview for cableready ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
if you provide it a string or already call .dispatch in the controller it would fail
operations
ActionController renderer in favor of cable_ready
ActionController::Renderers
hopsoft
approved these changes
Mar 10, 2023
Mime::Type.register "application/vnd.cable-ready.json", :cable_ready | ||
ActionController::Renderers.add :cable_ready do |operations, options| | ||
response.content_type ||= Mime[:cable_ready] | ||
response.headers["X-Cable-Ready-Version"] = CableReady::VERSION |
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.
The addition of the version header will be helpful.
jibees
added a commit
to jibees/mrujs
that referenced
this pull request
Mar 30, 2023
Since stimulusreflex/cable_ready#260, `cable_ready` changed its Content-Type to `text/vnd.cable-ready.json`. This commit updates the default one used to be compatible with `cable_ready`.
KonnorRogers
pushed a commit
to KonnorRogers/mrujs
that referenced
this pull request
May 25, 2023
…ready`: `text/vnd.cable-ready.json` (#209) * Update default Content-Type to reflect the one used by `cable_ready` Since stimulusreflex/cable_ready#260, `cable_ready` changed its Content-Type to `text/vnd.cable-ready.json`. This commit updates the default one used to be compatible with `cable_ready`. * Add some documentation about how `Accept` header can be modified
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of PR
Deprecation + Enhancement
Description
CableReady's
render operations:
ActionController renderer doesn't indicate that it's coming/being used for CableReady operations. This pull request renames the renderer torender cable_ready:
and adds a deprecation warning for theoperations
renderer.Additionally it make the DX around it a little bit better by checking if the passed argument responds to
.dispatch
before calling it. This helps when you already called.dispatch
in the controller action or if you provide it a already converted JSON string.This pull request also changes the
cable_ready
MIME type fromapplication/vnd.cable-ready.json
totext/vnd.cable-ready.json
so that the response from a controller action can be viewed in a browser.Finally, this pull request adds the
X-Cable-Ready-Version
header to the response.Why should this be added
This is an effort to keep the naming consistent and scope all CableReady functions with its own name. Following up on #259, #252 and #250.
Checklist