-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-signup-debug.js
More file actions
55 lines (46 loc) · 1.28 KB
/
Copy pathtest-signup-debug.js
File metadata and controls
55 lines (46 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Test signup API to debug organization creation
const http = require('http');
async function testSignup() {
const testData = JSON.stringify({
email: `test-${Date.now()}@example.com`,
password: 'TestPassword123!',
firstName: 'Test',
lastName: 'User',
organizationName: 'Acme Inc.'
});
const options = {
hostname: 'localhost',
port: 3010,
path: '/api/auth/signup',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(testData)
}
};
console.log('Testing signup with data:', JSON.parse(testData));
const req = http.request(options, (res) => {
console.log(`Status Code: ${res.statusCode}`);
console.log(`Headers:`, res.headers);
let body = '';
res.on('data', (chunk) => {
body += chunk;
});
res.on('end', () => {
console.log('Response Body:', body);
try {
const json = JSON.parse(body);
console.log('Parsed Response:', JSON.stringify(json, null, 2));
} catch (e) {
console.log('Failed to parse as JSON');
}
});
});
req.on('error', (error) => {
console.error('Request error:', error);
});
req.write(testData);
req.end();
}
// Wait a bit for server to be fully ready
setTimeout(testSignup, 2000);