Skip to content

Commit

Permalink
Fix bug on synchronize library
Browse files Browse the repository at this point in the history
  • Loading branch information
Zorin95670 committed Oct 15, 2024
1 parent 2af0b9b commit dc6bbbf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/services/LibraryService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
2 changes: 1 addition & 1 deletion tests/e2e/support/step_definitions/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
6 changes: 5 additions & 1 deletion tests/unit/services/LibraryService.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
});
});
Expand Down

0 comments on commit dc6bbbf

Please sign in to comment.