Skip to content

Incorrect Accept header used #23

Closed
@jacob-carlborg-apoex

Description

@jacob-carlborg-apoex

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions