const http = require('http');

// Test the exact same request as your curl
const postData = JSON.stringify({
  "email": "parent@email.com",
  "password": "cGFzc3dvcmQxMjM="
});

const options = {
  hostname: 'localhost',
  port: 3002,
  path: '/api/auth/school/login',
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Content-Length': Buffer.byteLength(postData)
  }
};

console.log('Testing exact curl request...');
console.log('Email: parent@email.com');
console.log('Endpoint: /api/auth/school/login');
console.log('Password (base64):', "cGFzc3dvcmQxMjM=");
console.log('Password (decoded):', Buffer.from("cGFzc3dvcmQxMjM=", 'base64').toString());

const req = http.request(options, (res) => {
  let data = '';
  
  res.on('data', (chunk) => {
    data += chunk;
  });
  
  res.on('end', () => {
    console.log('\nResponse status:', res.statusCode);
    console.log('Response:', data);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(postData);
req.end();