Skip to content

Commit 8b8eee4

Browse files
committed
fix: try to fix problem with http + disableStrictSSL
1 parent 37d1a67 commit 8b8eee4

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,10 @@ interface GenerateApiParamsBase {
151151
typePrefix?: string;
152152
/** suffix string value for type names */
153153
typeSuffix?: string;
154+
/** extra configuration for extracting type names operations */
154155
extractingOptions?: Partial<ExtractingOptions>;
156+
/** configuration for fetching swagger schema requests */
157+
requestOptions?: null | Partial<import("node-fetch").RequestInit>;
155158
}
156159

157160
type CodeGenConstruct = {
@@ -529,6 +532,7 @@ export interface GenerateApiConfiguration {
529532
routes: ParsedRoute[];
530533
}[];
531534
};
535+
requestOptions?: null | Partial<import("node-fetch").RequestInit>;
532536
utils: {
533537
formatDescription: (description: string, inline?: boolean) => string;
534538
internalCase: (value: string) => string;

src/util/request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Request {
3535
};
3636

3737
if (disableStrictSSL) {
38-
const { Agent } = _.startsWith(url, "http://") ? http : https;
38+
const Agent = _.startsWith(url, "http://") ? http.Agent.bind(http) : https.Agent.bind(https);
3939
requestOptions.agent = new Agent({
4040
rejectUnauthorized: false,
4141
});

0 commit comments

Comments
 (0)