File tree 1 file changed +10
-2
lines changed
sdk-template-overrides/typescript-axios
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 3
3
{ {> licenseInfo} }
4
4
5
5
{ {! Edited by OpenAI, line 6 } }
6
- const packageJson = require("../package.json");
6
+ import FormData from "form-data";
7
+ import filedirname from "filedirname";
8
+ import fs from "fs";
9
+ import path from "path";
10
+
11
+ const [, dirname] = filedirname();
12
+ const filePath = path.join(dirname, '../package.json');
13
+ const contents = fs.readFileSync(filePath, { encoding: ' utf8' } );
14
+ const packageJson = JSON.parse(contents);
7
15
8
16
export interface ConfigurationParameters {
9
17
apiKey?: string | Promise< string> | ((name: string) => string) | ((name: string) => Promise< string> );
@@ -100,7 +108,7 @@ export class Configuration {
100
108
this.baseOptions.headers[' OpenAI-Organization' ] = this.organization;
101
109
}
102
110
if (!this.formDataCtor) {
103
- this.formDataCtor = require( " form-data " ) ;
111
+ this.formDataCtor = FormData ;
104
112
}
105
113
}
106
114
You can’t perform that action at this time.
0 commit comments