graphiti-api / graphiti-rails

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Don't set `format` when parsing parameters

wagenet opened this issue · comments

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

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

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 👍

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

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 :/