const axios = require('axios');

async function test() {
    console.log('Testing official MySQL endpoints...');
    const urls = [
        'https://downloads.mysql.com/archives/community/?json=1',
        'https://downloads.mysql.com/archives/community/?tpl=version&os=3&json=1',
        'https://dev.mysql.com/downloads/mysql/?json=1',
        'https://dev.mysql.com/downloads/mysql/?tpl=version&os=3&json=1'
    ];

    for (const url of urls) {
        try {
            const response = await axios.get(url, {
                headers: {
                    'Accept': 'application/json',
                    'X-Requested-With': 'XMLHttpRequest'
                },
                timeout: 5000
            });
            console.log(`URL: ${url}`);
            console.log(`STATUS: ${response.status}`);
            console.log(`CONTENT-TYPE: ${response.headers['content-type']}`);
            console.log(`IS JSON: ${typeof response.data === 'object'}`);
            if (typeof response.data === 'object') {
                console.log('DATA PREVIEW:', JSON.stringify(response.data).substring(0, 200));
            } else {
                console.log('DATA PREVIEW (100 chars):', String(response.data).substring(0, 100));
            }
            console.log('---');
        } catch (e) {
            console.log(`URL: ${url} failed: ${e.message}`);
        }
    }
}

test();
