Skip to content

Commit 73447c8

Browse files
fairkingManweill
authored andcommitted
allow_self_signed_certificates
1 parent 39a0fa7 commit 73447c8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import { requestCodegen, IRequestClass, IRequestMethods } from './requestCodegen
2020
import { componentsCodegen } from './componentsCodegen'
2121
import { definitionsCodeGen } from './definitionCodegen'
2222

23+
const https = require('https');
24+
2325
const defaultOptions: ISwaggerOptions = {
2426
serviceNameSuffix: 'Service',
2527
enumNamePrefix: 'Enum',
@@ -51,7 +53,7 @@ export async function codegen(params: ISwaggerOptions) {
5153
// 获取接口定义文件
5254
try {
5355
if (params.remoteUrl) {
54-
const { data: swaggerJson } = await axios({ url: params.remoteUrl, responseType: 'text' })
56+
const { data: swaggerJson } = await axios({ url: params.remoteUrl, responseType: 'text', httpsAgent: new https.Agent({ rejectUnauthorized: false }) })
5557
if (Object.prototype.toString.call(swaggerJson) === '[object String]') {
5658
fs.writeFileSync(swaggerSpecFileName, swaggerJson)
5759
swaggerSource = require(path.resolve(swaggerSpecFileName))

0 commit comments

Comments
 (0)