diff --git a/src/hydra/dataProvider.ts b/src/hydra/dataProvider.ts index a7efd355..cb45872c 100644 --- a/src/hydra/dataProvider.ts +++ b/src/hydra/dataProvider.ts @@ -182,7 +182,7 @@ function normalizeHydraKey(json: JsonLdObj, key: string): JsonLdObj { * GET_LIST => GET http://my.api.url/posts * GET_MANY => GET http://my.api.url/posts/123, GET http://my.api.url/posts/456, GET http://my.api.url/posts/789 * GET_ONE => GET http://my.api.url/posts/123 - * UPDATE => PUT http://my.api.url/posts/123 + * UPDATE => PATCH http://my.api.url/posts/123 */ function dataProvider( factoryParams: HydraDataProviderFactoryParams, @@ -366,7 +366,7 @@ function dataProvider( if (typeof params.meta === 'object') { extraInformation = params.meta; } - const updateHttpMethod = extraInformation.hasFileField ? 'POST' : 'PUT'; + const updateHttpMethod = extraInformation.hasFileField ? 'POST' : 'PATCH'; switch (type) { case CREATE: @@ -488,6 +488,7 @@ function dataProvider( options: { body, method: updateHttpMethod, + headers: updateHttpMethod === 'PATCH' ? { 'content-type': 'application/merge-patch+json' } : {} }, url, }));