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

Don't set format when parsing parameters #72

Open
wagenet opened this issue Jun 8, 2021 · 4 comments
Open

Don't set format when parsing parameters #72

wagenet opened this issue Jun 8, 2021 · 4 comments

Comments

@wagenet
Copy link
Collaborator

wagenet commented Jun 8, 2021

Setting the format in parameters has a special behavior in Rails. One side effect is respond_to will now ignore any provided Accept header in favor of the provided format. The default Rails json parser doesn't set format and it doesn't seem to me that we need to set it either.

data[:format] = :jsonapi

@wagenet
Copy link
Collaborator Author

wagenet commented Jun 8, 2021

Also, is there any reason why we shouldn't just use the same behavior as the built-in json handler?

@richmolj
Copy link
Collaborator

richmolj commented Jun 8, 2021

I think this is so users can pass in a normal application/json instead of application/vnd.api+json and still get JSON:API rendered. Originally because it's a hurdle to get up and running quickly for new users, at this point it's more for backwards-compatibility.

If you can accomodate that use case and everything still seems to be working correctly I'm 👍

@wagenet
Copy link
Collaborator Author

wagenet commented Jun 8, 2021

I changed it and no tests failed, so not sure.

@richmolj
Copy link
Collaborator

richmolj commented Jun 8, 2021

Yeah I am just not sure. That block was originally copied from jsonapi-rb I know, but I think I added the format part.

I'm mentally 👍 but just kinda scared :/

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

No branches or pull requests

2 participants