Skip to content

Commit 5e46b20

Browse files
authored
Merge pull request #899 from mildsunrise/use-isomorphic-fetch
[typescript-fetch] use isomorphic-fetch
2 parents 7ad4d49 + 0d255d2 commit 5e46b20

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/main/resources/handlebars/typescript-fetch/api.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{{>licenseInfo}}
44

55
import * as url from "url";
6-
import * as portableFetch from "portable-fetch";
6+
import * as isomorphicFetch from "isomorphic-fetch";
77
import { Configuration } from "./configuration";
88

99
const BASE_PATH = "{{{basePath}}}".replace(/\/+$/, "");
@@ -46,7 +46,7 @@ export interface FetchArgs {
4646
export class BaseAPI {
4747
protected configuration: Configuration;
4848
49-
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = portableFetch) {
49+
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = isomorphicFetch) {
5050
if (configuration) {
5151
this.configuration = configuration;
5252
this.basePath = configuration.basePath || this.basePath;
@@ -262,7 +262,7 @@ export const {{classname}}Fp = function(configuration?: Configuration) {
262262
*/
263263
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}> {
264264
const localVarFetchArgs = {{classname}}FetchParamCreator(configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options);
265-
return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => {
265+
return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => {
266266
return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
267267
if (response.status >= 200 && response.status < 300) {
268268
return response{{#returnType}}.json(){{/returnType}};
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
declare module 'portable-fetch';
1+
declare module 'isomorphic-fetch';
22
declare module 'url';

src/main/resources/handlebars/typescript-fetch/package.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"prepublishOnly": "npm run build"
1919
},
2020
"dependencies": {
21-
"portable-fetch": "^3.0.0"
21+
"isomorphic-fetch": "^3.0.0"
2222
},
2323
"devDependencies": {
2424
"@types/jest": "^25.2.1",

src/main/resources/mustache/typescript-fetch/package.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"prepublishOnly": "npm run build"
1919
},
2020
"dependencies": {
21-
"portable-fetch": "^3.0.0"
21+
"isomorphic-fetch": "^3.0.0"
2222
},
2323
"devDependencies": {
2424
"@types/jest": "^25.2.1",

0 commit comments

Comments
 (0)