Skip to content
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

Better support API-only Rails applications #1128

Merged
merged 2 commits into from
Dec 2, 2024
Merged

Better support API-only Rails applications #1128

merged 2 commits into from
Dec 2, 2024

Conversation

etiennebarrie
Copy link
Member

Fix #992

While we can't automatically get full compatibility with API-only applications, we can make it easier by not using PUT and documenting how to add the missing middleware necessary for our engine.

Copy link
Contributor

@adrianna-chang-shopify adrianna-chang-shopify left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small suggestions on the docs but otherwise looks good! Thanks for getting this up!

README.md Outdated
### Using Maintenance Tasks in API-only applications

The Maintenance Tasks engine uses Rails sessions for flash messages and storing
the CRSF token. For the engine to work in an API-only Rails application, you need
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
the CRSF token. For the engine to work in an API-only Rails application, you need
the CSRF token. For the engine to work in an API-only Rails application, you need

README.md Outdated

The Maintenance Tasks engine uses Rails sessions for flash messages and storing
the CRSF token. For the engine to work in an API-only Rails application, you need
to add a [session middleware][] and the Flash middleware. The engine also defines
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe let's call out the Flash middleware more explicitly?

Suggested change
to add a [session middleware][] and the Flash middleware. The engine also defines
to add a [session middleware][] and the `ActionDispatch::Flash` middleware. The engine also defines

README.md Outdated
Comment on lines 903 to 905
a strict [Content Security Policy][], but it won't make it to the user's browser
unless you also include the appropriate middleware
(`ActionDispatch::ContentSecurityPolicy::Middleware`).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny nit: can we make the wording on this more action-oriented?

Suggested change
a strict [Content Security Policy][], but it won't make it to the user's browser
unless you also include the appropriate middleware
(`ActionDispatch::ContentSecurityPolicy::Middleware`).
a strict [Content Security Policy][]. Make sure to include `ActionDispatch::ContentSecurityPolicy::Middleware`
in your app's middleware stack to ensure the CSP is delivered to the user's browser.

@etiennebarrie etiennebarrie merged commit a2df402 into main Dec 2, 2024
35 checks passed
@etiennebarrie etiennebarrie deleted the api-only branch December 2, 2024 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change PUT methods to POST methods for better compat with API mode apps
3 participants