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

Incorrect Accept header used #23

Closed
jacob-carlborg-apoex opened this issue Dec 19, 2024 · 0 comments
Closed

Incorrect Accept header used #23

jacob-carlborg-apoex opened this issue Dec 19, 2024 · 0 comments

Comments

@jacob-carlborg-apoex
Copy link
Contributor

I tried to use this gem with the rails_admin gem and hit a problem. When a file is modified and hotwire-spark makes a request to the server to get the new content it uses the fetch function in JavaScript. When Rails receives the request the Accept header is set to */*. This causes rails_admin to render the page as JSON due to the order of how the formats are specified in respond_to [1].

I'm arguing that this is wrong (or at least unexpected) behavior. But rails_admin works when used normally in a web browser, because the web browser always sets an explicit Accept header to text/html. So I'm also arguing that hotwire-spark should behave as close as possible to the actual web browser when making requests and therefore should set an explicit Accept header.

[1] railsadminteam/rails_admin#3705

jorgemanrubia added a commit that referenced this issue Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant