Skip to content

Commit 962c0fc

Browse files
committed
chrome swagger ui extension scheme funny bug fixed - if chtome then swagger doc scheme is the boss
1 parent abfff47 commit 962c0fc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/client.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,10 @@ SwaggerClient.prototype.buildFromSpec = function (response) {
353353
else {
354354
this.scheme = location.scheme || 'http';
355355
}
356-
} else if (typeof this.scheme === 'undefined') {
356+
} else if (typeof window !== 'undefined' && window.location.protocol.startsWith('chrome-extension')) {
357+
// if it is chrome swagger ui extension scheme then let swagger doc url scheme decide the protocol
358+
this.scheme = location.scheme;
359+
} else if (typeof this.scheme === 'undefined') {
357360
if(typeof window !== 'undefined') {
358361
var scheme = window.location.protocol.replace(':','');
359362
if(scheme === 'https' && this.schemes.indexOf(scheme) === -1) {

0 commit comments

Comments
 (0)