-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdebug-admin.ts
34 lines (29 loc) · 1.13 KB
/
debug-admin.ts
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
import fetch from 'node-fetch';
const checkAdminRoute = async () => {
try {
console.log('Checking admin route...');
const response = await fetch('http://localhost:3000/admin');
console.log(`Status: ${response.status}`);
console.log(`Headers: ${JSON.stringify(response.headers.raw(), null, 2)}`);
if (response.redirected) {
console.log(`Redirected to: ${response.url}`);
const authResponse = await fetch(response.url);
console.log(`Auth Status: ${authResponse.status}`);
try {
const text = await authResponse.text();
console.log(`Auth Response Body (first 500 chars): ${text.substring(0, 500)}${text.length > 500 ? '...' : ''}`);
} catch (e) {
console.log(`Could not get auth response body: ${e}`);
}
}
try {
const text = await response.text();
console.log(`Response Body (first 500 chars): ${text.substring(0, 500)}${text.length > 500 ? '...' : ''}`);
} catch (e) {
console.log(`Could not get response body: ${e}`);
}
} catch (error) {
console.error('Error checking admin route:', error);
}
};
checkAdminRoute();