ObsiViewer/test-rename-endpoint.js

24 lines
599 B
JavaScript

// Test script for the rename folder endpoint
const testRenameEndpoint = async () => {
try {
const response = await fetch('http://localhost:3000/api/folders/rename', {
method: 'PUT',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
oldPath: 'test',
newName: 'test-renamed'
})
});
const result = await response.json();
console.log('Response status:', response.status);
console.log('Response body:', result);
} catch (error) {
console.error('Test failed:', error);
}
};
testRenameEndpoint();