29 lines
1.2 KiB
JavaScript
29 lines
1.2 KiB
JavaScript
const { getAuth } = require('./auth_manager');
|
|
|
|
async function main() {
|
|
const { token, userId } = await getAuth();
|
|
const repo = '3d5666fe-95db-4e73-b6b2-dd0e41fca7f6';
|
|
const auth = Buffer.from(userId + ':' + token).toString('base64');
|
|
console.log('Initiating POST...');
|
|
const postRes = await fetch(`https://registry.ghaymah.systems/v2/${userId}/${repo}/blobs/uploads/`, {
|
|
method: 'POST',
|
|
headers: { 'Authorization': 'Basic ' + auth }
|
|
});
|
|
console.log('POST status:', postRes.status);
|
|
console.log('POST Www-Auth:', postRes.headers.get('www-authenticate'));
|
|
console.log('Testing monolithic POST...');
|
|
const monoRes = await fetch(`https://registry.ghaymah.systems/v2/${userId}/${repo}/blobs/uploads/?digest=sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Authorization': 'Basic ' + auth,
|
|
'Content-Type': 'application/octet-stream',
|
|
'Content-Length': '0'
|
|
}
|
|
});
|
|
console.log('Monolithic POST status:', monoRes.status, monoRes.statusText);
|
|
console.log('Monolithic POST body:', await monoRes.text());
|
|
console.log('Monolithic POST headers:', Object.fromEntries(monoRes.headers.entries()));
|
|
}
|
|
|
|
main().catch(console.error);
|