ra-data-postgrest icon indicating copy to clipboard operation
ra-data-postgrest copied to clipboard

The create method should return the data returned by Postgrest and not the posted data

Open christiaanwesterbeek opened this issue 2 years ago • 0 comments

Currently, the create method simply returns what the posted data is (including the id returned by Postgrest). However the Prefer: 'return=representation' is passed in the request which means that Postgrest is going to return the data of the new record. So the create method should simply return the json and not { ...params.data, id: encodeId(json, primaryKey) }

I know the example rest implementation indeed shows returning the posted data, but our dataProvider specifically adds this Prefer: 'return=representation' header, so we know that Postgrest is going to return the data and we should use that for the response.

Thoughts?

christiaanwesterbeek avatar Sep 29 '22 16:09 christiaanwesterbeek