Unable to use `fields` with a POST/PUT request
Hello there,
We've been experiencing an issue with Devour where passing fields: { comments: 'title' } will not get serialized for create or update calls.
For GET requests it will pass fields[comments]=title but for other types of requests it will send fields={"comments": "title"}.
I could track this issue down to those lines:
https://github.com/twg/devour/blob/e27377c3b5734ae026ff770477fee608c2f4d936/src/middleware/json-api/rails-params-serializer.js#L6-L13
I suppose that this kind of if has a reason for being present but I didn't find one.
- Is there a way to change this behavior without having to fork/patch Devour?
- Would you be interested in a PR to remove the
if?
Thanks ❤️
@simonc I'd be interested in getting a PR out removing the if. I'm not sure what the JSON:API spec is related to this, maybe it only allows for field parameters with GET requests?