-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-webhook-url.js
More file actions
29 lines (24 loc) · 978 Bytes
/
Copy pathtest-webhook-url.js
File metadata and controls
29 lines (24 loc) · 978 Bytes
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
// Test webhook URL construction
console.log('Testing webhook URL construction...');
// Simulate Vercel environment
const mockVercelUrl1 = 'video-to-audio-hmbj9qg1p-ernestos-projects-e9a7d5c3.vercel.app';
const mockVercelUrl2 = 'https://video-to-audio-hmbj9qg1p-ernestos-projects-e9a7d5c3.vercel.app';
console.log('\nTest 1 - VERCEL_URL without https://');
const webhookUrl1 = `https://${mockVercelUrl1}/api/webhook/processing-complete`;
console.log('Webhook URL:', webhookUrl1);
console.log('\nTest 2 - VERCEL_URL with https://');
const webhookUrl2 = `https://${mockVercelUrl2}/api/webhook/processing-complete`;
console.log('Webhook URL:', webhookUrl2);
console.log('\nTest 3 - URL validation');
try {
new URL(webhookUrl1);
console.log('webhookUrl1 is valid');
} catch (e) {
console.log('webhookUrl1 is INVALID:', e.message);
}
try {
new URL(webhookUrl2);
console.log('webhookUrl2 is valid');
} catch (e) {
console.log('webhookUrl2 is INVALID:', e.message);
}