Browse Source

fix: add both schemes in swagger

fix #311

Signed-off-by: Pranav C <61551451+pranavxc@users.noreply.github.com>
pull/341/head
Pranav C 3 years ago
parent
commit
738d3a71aa
  1. 2
      packages/nocodb/src/lib/noco/rest/RestApiBuilder.ts

2
packages/nocodb/src/lib/noco/rest/RestApiBuilder.ts

@ -1514,7 +1514,7 @@ export class RestApiBuilder extends BaseApiBuilder<Noco> {
const host = process.env.NC_PUBLIC_URL ? new URL(process.env.NC_PUBLIC_URL)?.host : req.get('host');
const scheme = process.env.NC_PUBLIC_URL ? new URL(process.env.NC_PUBLIC_URL)?.protocol.slice(0, -1) : req.protocol;
swaggerBaseDocument.host = host;
swaggerBaseDocument.schemes = [scheme];
swaggerBaseDocument.schemes = [scheme, scheme === 'http' ? 'https' : 'http'];
glob.sync(path.join(this.config.toolDir, 'nc', this.projectId, this.getDbAlias(), 'swagger', 'swagger.json')).forEach(jsonFile => {
const swaggerJson = JSON.parse(fs.readFileSync(jsonFile, 'utf8'));
swaggerBaseDocument.tags.push(...swaggerJson.tags);

Loading…
Cancel
Save