-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtest-https-conversion.js
More file actions
39 lines (33 loc) · 1.33 KB
/
Copy pathtest-https-conversion.js
File metadata and controls
39 lines (33 loc) · 1.33 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
// Test HTTPS URL conversion functionality
const ensureHttpsUrl = (url) => {
// Simulate HTTPS environment
if ('https:' === 'https:' && url.startsWith('http:')) {
return url.replace('http:', 'https:');
}
return url;
};
const testUrls = [
'http://aac.saavncdn.com/815/483a6e118e8108cbb3e5cd8701674f32_320.mp4',
'https://aac.saavncdn.com/815/483a6e118e8108cbb3e5cd8701674f32_320.mp4',
'http://example.com/audio.mp3',
'https://example.com/audio.mp3'
];
console.log('🧪 HTTPS URL Conversion Test Results:');
console.log('=====================================');
testUrls.forEach((url, index) => {
const converted = ensureHttpsUrl(url);
const changed = url !== converted;
console.log(`Test ${index + 1}:`);
console.log(` Original: ${url}`);
console.log(` Converted: ${converted}`);
console.log(` Changed: ${changed ? '✅ YES' : '❌ NO'}`);
console.log('');
});
// Test specific problematic URL from the error
const problematicUrl = 'http://aac.saavncdn.com/815/483a6e118e8108cbb3e5cd8701674f32_320.mp4';
const fixedUrl = ensureHttpsUrl(problematicUrl);
console.log('🎯 Specific Fix Test:');
console.log('====================');
console.log(`Problematic URL: ${problematicUrl}`);
console.log(`Fixed URL: ${fixedUrl}`);
console.log(`Mixed Content Fixed: ${fixedUrl.startsWith('https:') ? '✅ YES' : '❌ NO'}`);