diff --git a/src/hydra/dataProvider.test.ts b/src/hydra/dataProvider.test.ts index 287e5d75..d081010a 100644 --- a/src/hydra/dataProvider.test.ts +++ b/src/hydra/dataProvider.test.ts @@ -333,6 +333,7 @@ describe('Transform a React Admin request to an Hydra request', () => { previousData: { id: '/entrypoint/resource/1', }, + meta: undefined, }); const url = mockFetchHydra.mock.calls?.[0]?.[0] ?? new URL('https://foo'); expect(url).toBeInstanceOf(URL); diff --git a/src/hydra/dataProvider.ts b/src/hydra/dataProvider.ts index a721b534..1d09f69e 100644 --- a/src/hydra/dataProvider.ts +++ b/src/hydra/dataProvider.ts @@ -351,10 +351,10 @@ function dataProvider( } }); let extraInformation: { hasFileField?: boolean } = {}; - if ('meta' in params) { + if (typeof params.meta === 'object') { extraInformation = params.meta; } - const updateHttpMethod = extraInformation?.hasFileField ? 'POST' : 'PUT'; + const updateHttpMethod = extraInformation.hasFileField ? 'POST' : 'PUT'; switch (type) { case CREATE: