Files
ghaymah-dns-net-sec-tests/scripts/test_consecutive_uploads.js
T

24 lines
776 B
JavaScript

const { getAuth } = require('./auth_manager');
async function test() {
const { token, userId } = await getAuth(true); // Force fresh token
console.log('Got fresh token!');
const auth = Buffer.from(userId + ':' + token).toString('base64');
for (let i = 1; i <= 5; i++) {
const res = await fetch(`https://registry.ghaymah.systems/v2/${userId}/soc-gateway/blobs/uploads/`, {
method: 'POST',
headers: { 'Authorization': 'Basic ' + auth }
});
console.log(`Attempt ${i}: Status = ${res.status}`);
if (!res.ok) {
console.log('Error:', await res.text());
} else {
console.log('Location:', res.headers.get('location')?.substring(0, 50));
}
await new Promise(r => setTimeout(r, 1000));
}
}
test().catch(console.error);