Skip to content

Commit 0741cda

Browse files
committed
Exclude CancelablePromise from index when axios
1 parent 7e43a95 commit 0741cda

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

src/templates/index.hbs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ export { ApiError } from './core/ApiError';
99
{{#if @root.exportClient}}
1010
export { BaseHttpRequest } from './core/BaseHttpRequest';
1111
{{/if}}
12+
{{#notEquals @root.httpClient 'axios'}}
1213
export { CancelablePromise, CancelError } from './core/CancelablePromise';
14+
{{/notEquals}}
1315
export { OpenAPI } from './core/OpenAPI';
1416
export type { OpenAPIConfig } from './core/OpenAPI';
1517
{{/if}}

src/utils/writeClient.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ export const writeClient = async (
105105
client,
106106
templates,
107107
outputPath,
108+
httpClient,
108109
useUnionTypes,
109110
exportCore,
110111
exportServices,

src/utils/writeClientIndex.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { resolve } from 'path';
22

33
import type { Client } from '../client/interfaces/Client';
4+
import { HttpClient } from '../HttpClient';
45
import { writeFile } from './fileSystem';
56
import type { Templates } from './registerHandlebarTemplates';
67
import { writeClientIndex } from './writeClientIndex';
@@ -37,7 +38,7 @@ describe('writeClientIndex', () => {
3738
},
3839
};
3940

40-
await writeClientIndex(client, templates, '/', true, true, true, true, true, 'Service', '');
41+
await writeClientIndex(client, templates, '/', HttpClient.FETCH, true, true, true, true, true, 'Service', '');
4142

4243
expect(writeFile).toBeCalledWith(resolve('/', '/index.ts'), 'index');
4344
});

src/utils/writeClientIndex.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { resolve } from 'path';
22

33
import type { Client } from '../client/interfaces/Client';
4+
import { HttpClient } from '../HttpClient';
45
import { writeFile } from './fileSystem';
56
import { isDefined } from './isDefined';
67
import { Templates } from './registerHandlebarTemplates';
@@ -27,6 +28,7 @@ export const writeClientIndex = async (
2728
client: Client,
2829
templates: Templates,
2930
outputPath: string,
31+
httpClient: HttpClient,
3032
useUnionTypes: boolean,
3133
exportCore: boolean,
3234
exportServices: boolean,
@@ -37,6 +39,7 @@ export const writeClientIndex = async (
3739
clientName?: string
3840
): Promise<void> => {
3941
const templateResult = templates.index({
42+
httpClient,
4043
exportCore,
4144
exportServices,
4245
exportModels,

0 commit comments

Comments
 (0)