19 lines
456 B
JavaScript
19 lines
456 B
JavaScript
// scanner/deleteWithAuth.js
|
|
const { API_KEY } = require('../config');
|
|
|
|
module.exports = async function deleteWithAuth(url) {
|
|
// import dinamico compatibile con CommonJS
|
|
const fetch = (await import('node-fetch')).default;
|
|
|
|
const res = await fetch(url, {
|
|
method: 'DELETE',
|
|
headers: {
|
|
'x-api-key': API_KEY,
|
|
'Content-Type': 'application/json'
|
|
}
|
|
});
|
|
|
|
if (!res.ok) {
|
|
throw new Error(`DELETE failed: ${res.status}`);
|
|
}
|
|
};
|