diff --git a/src/services/LibraryService.js b/src/services/LibraryService.js index 85ac750f..6af39f27 100644 --- a/src/services/LibraryService.js +++ b/src/services/LibraryService.js @@ -72,5 +72,9 @@ export async function create(url, role) { export async function synchronize(id, url) { const api = await prepareRequest(); - return api.put(`/libraries/${id}`, { url }).then(({ data }) => data); + return api.put(`/libraries/${id}`, url, { + headers: { + 'Content-Type': 'text/plain', + }, + }).then(({ data }) => data); } diff --git a/tests/e2e/support/step_definitions/api.js b/tests/e2e/support/step_definitions/api.js index 10672dd6..91ba909b 100644 --- a/tests/e2e/support/step_definitions/api.js +++ b/tests/e2e/support/step_definitions/api.js @@ -875,7 +875,7 @@ function setLibraryIntercepts() { }); cy.intercept('PUT', '/api/libraries/1', (request) => { - const { url } = request.body; + const url = request.body; if (url === 'notFound') { request.reply({ diff --git a/tests/unit/services/LibraryService.test.js b/tests/unit/services/LibraryService.test.js index 9ba02fa6..869fa26b 100644 --- a/tests/unit/services/LibraryService.test.js +++ b/tests/unit/services/LibraryService.test.js @@ -114,7 +114,11 @@ describe('Test: LibraryService', () => { const result = await LibraryService.synchronize('id', 'url'); - expect(mockPutRequest).toBeCalledWith('/libraries/id', { url: 'url' }); + expect(mockPutRequest).toBeCalledWith('/libraries/id', 'url', { + headers: { + 'Content-Type': 'text/plain', + }, + }); expect(result).toEqual({ id: 1 }); }); });