fix: duplicate downloading of remote config (#6544)

This commit is contained in:
Aleksandr Zhuravlev
2020-10-22 03:57:31 +03:00
committed by GitHub
parent 671e945376
commit 50e5f653cc

View File

@@ -177,15 +177,15 @@ export default function SwaggerUI(opts) {
const configUrl = queryConfig.config || constructorConfig.configUrl
if (!configUrl || !system.specActions || !system.specActions.getConfigByUrl || system.specActions.getConfigByUrl && !system.specActions.getConfigByUrl({
url: configUrl,
loadRemoteConfig: true,
requestInterceptor: constructorConfig.requestInterceptor,
responseInterceptor: constructorConfig.responseInterceptor,
}, downloadSpec)) {
return downloadSpec()
if (configUrl && system.specActions && system.specActions.getConfigByUrl) {
system.specActions.getConfigByUrl({
url: configUrl,
loadRemoteConfig: true,
requestInterceptor: constructorConfig.requestInterceptor,
responseInterceptor: constructorConfig.responseInterceptor,
}, downloadSpec)
} else {
system.specActions.getConfigByUrl(configUrl, downloadSpec)
return downloadSpec()
}
return system