Skip to content

Commit dba3b64

Browse files
David JöchDavid Joech
authored andcommitted
[typescript-fetch] added option to override default basePath
1 parent bad1885 commit dba3b64

File tree

2 files changed

+10
-2
lines changed
  • modules/swagger-codegen/src/main/resources/typescript-fetch
  • samples/client/petstore/typescript-fetch/builds/default

2 files changed

+10
-2
lines changed

modules/swagger-codegen/src/main/resources/typescript-fetch/api.mustache

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as url from "url";
66
import * as portableFetch from "portable-fetch";
77
import { Configuration } from "./configuration";
88

9-
const BASE_PATH = "{{{basePath}}}".replace(/\/+$/, "");
9+
let BASE_PATH = "{{{basePath}}}".replace(/\/+$/, "");
1010

1111
/**
1212
*
@@ -19,6 +19,10 @@ export const COLLECTION_FORMATS = {
1919
pipes: "|",
2020
};
2121

22+
export function setBasePath(basePath: string): void {
23+
BASE_PATH = basePath;
24+
}
25+
2226
/**
2327
*
2428
* @export

samples/client/petstore/typescript-fetch/builds/default/api.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import * as url from "url";
1717
import * as portableFetch from "portable-fetch";
1818
import { Configuration } from "./configuration";
1919

20-
const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, "");
20+
let BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, "");
2121

2222
/**
2323
*
@@ -30,6 +30,10 @@ export const COLLECTION_FORMATS = {
3030
pipes: "|",
3131
};
3232

33+
export function setBasePath(basePath: string): void {
34+
BASE_PATH = basePath;
35+
}
36+
3337
/**
3438
*
3539
* @export

0 commit comments

Comments
 (0)