Skip to content

Commit cfdbe48

Browse files
committed
- Removed cross-blob dependency since node now supports this
1 parent 7086776 commit cfdbe48

15 files changed

+24
-19
lines changed

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,6 @@ classes in NodeJS).
457457

458458
```
459459
npm install axios --save-dev
460-
npm install [email protected] --save-dev
461460
npm install [email protected] --save-dev
462461
```
463462

@@ -481,7 +480,6 @@ in order to compile and run this client, you might need to install the `node-fet
481480
```
482481
npm install @types/[email protected] --save-dev
483482
npm install [email protected] --save-dev
484-
npm install [email protected] --save-dev
485483
npm install [email protected] --save-dev
486484
npm install [email protected] --save-dev
487485
```

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
"axios": "^0.24.0",
6666
"camelcase": "^6.3.0",
6767
"commander": "^8.3.0",
68-
"cross-blob": "^2.0.1",
6968
"form-data": "^4.0.0",
7069
"handlebars": "^4.7.6",
7170
"json-schema-ref-parser": "^9.0.7",

src/templates/core/axios/request.hbs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{{>header}}
22

33
import axios, { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios';
4-
import Blob from 'cross-blob'
54
import FormData from 'form-data';
65

76
import { ApiError } from './ApiError';
+10-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
function isBlob(value: any): value is Blob {
2-
return value instanceof Blob;
2+
return (
3+
typeof value === 'object' &&
4+
typeof value.type === 'string' &&
5+
typeof value.stream === 'function' &&
6+
typeof value.arrayBuffer === 'function' &&
7+
typeof value.constructor === 'function' &&
8+
typeof value.constructor.name === 'string' &&
9+
/^(Blob|File)$/.test(value.constructor.name) &&
10+
/^(Blob|File)$/.test(value[Symbol.toStringTag])
11+
);
312
}

test/e2e/v2.axios.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('v2.node', () => {
2424
expect(result.headers.authorization).toBe('Bearer MY_TOKEN');
2525
});
2626

27-
it('complexService', async () => {
27+
it('supports complex params', async () => {
2828
const { ComplexService } = require('./generated/v2/axios/index.js');
2929
const result = await ComplexService.complexTypes({
3030
first: {

test/e2e/v2.babel.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('v2.babel', () => {
3030
expect(result.headers.authorization).toBe('Bearer MY_TOKEN');
3131
});
3232

33-
it('complexService', async () => {
33+
it('supports complex params', async () => {
3434
const result = await browser.evaluate(async () => {
3535
const { ComplexService } = window.api;
3636
return await ComplexService.complexTypes({

test/e2e/v2.fetch.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('v2.fetch', () => {
3030
expect(result.headers.authorization).toBe('Bearer MY_TOKEN');
3131
});
3232

33-
it('complexService', async () => {
33+
it('supports complex params', async () => {
3434
const result = await browser.evaluate(async () => {
3535
const { ComplexService } = window.api;
3636
return await ComplexService.complexTypes({

test/e2e/v2.node.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('v2.node', () => {
2424
expect(result.headers.authorization).toBe('Bearer MY_TOKEN');
2525
});
2626

27-
it('complexService', async () => {
27+
it('supports complex params', async () => {
2828
const { ComplexService } = require('./generated/v2/node/index.js');
2929
const result = await ComplexService.complexTypes({
3030
first: {

test/e2e/v2.xhr.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('v2.xhr', () => {
3131
expect(result.headers.authorization).toBe('Bearer MY_TOKEN');
3232
});
3333

34-
it('complexService', async () => {
34+
it('supports complex params', async () => {
3535
const result = await browser.evaluate(async () => {
3636
const { ComplexService } = window.api;
3737
return await ComplexService.complexTypes({

test/e2e/v3.axios.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('v3.node', () => {
3535
expect(result.headers.authorization).toBe('Basic dXNlcm5hbWU6cGFzc3dvcmQ=');
3636
});
3737

38-
it('complexService', async () => {
38+
it('supports complex params', async () => {
3939
const { ComplexService } = require('./generated/v3/axios/index.js');
4040
const result = await ComplexService.complexTypes({
4141
first: {
@@ -47,7 +47,7 @@ describe('v3.node', () => {
4747
expect(result).toBeDefined();
4848
});
4949

50-
it('formData', async () => {
50+
it('supports form data', async () => {
5151
const { ParametersService } = require('./generated/v3/axios/index.js');
5252
const result = await ParametersService.callWithParameters(
5353
'valueHeader',

test/e2e/v3.babel.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('v3.babel', () => {
4343
expect(result.headers.authorization).toBe('Basic dXNlcm5hbWU6cGFzc3dvcmQ=');
4444
});
4545

46-
it('complexService', async () => {
46+
it('supports complex params', async () => {
4747
const result = await browser.evaluate(async () => {
4848
const { ComplexService } = window.api;
4949
return await ComplexService.complexTypes({

test/e2e/v3.fetch.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('v3.fetch', () => {
4343
expect(result.headers.authorization).toBe('Basic dXNlcm5hbWU6cGFzc3dvcmQ=');
4444
});
4545

46-
it('complexService', async () => {
46+
it('supports complex params', async () => {
4747
const result = await browser.evaluate(async () => {
4848
const { ComplexService } = window.api;
4949
return await ComplexService.complexTypes({
@@ -57,7 +57,7 @@ describe('v3.fetch', () => {
5757
expect(result).toBeDefined();
5858
});
5959

60-
it('formData', async () => {
60+
it('support form data', async () => {
6161
const result = await browser.evaluate(async () => {
6262
const { ParametersService } = window.api;
6363
return await ParametersService.callWithParameters(

test/e2e/v3.node.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('v3.node', () => {
3535
expect(result.headers.authorization).toBe('Basic dXNlcm5hbWU6cGFzc3dvcmQ=');
3636
});
3737

38-
it('complexService', async () => {
38+
it('supports complex params', async () => {
3939
const { ComplexService } = require('./generated/v3/node/index.js');
4040
const result = await ComplexService.complexTypes({
4141
first: {
@@ -47,7 +47,7 @@ describe('v3.node', () => {
4747
expect(result).toBeDefined();
4848
});
4949

50-
it('formData', async () => {
50+
it('support form data', async () => {
5151
const { ParametersService } = require('./generated/v3/node/index.js');
5252
const result = await ParametersService.callWithParameters(
5353
'valueHeader',

test/e2e/v3.xhr.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('v3.xhr', () => {
4343
expect(result.headers.authorization).toBe('Basic dXNlcm5hbWU6cGFzc3dvcmQ=');
4444
});
4545

46-
it('complexService', async () => {
46+
it('supports complex params', async () => {
4747
const result = await browser.evaluate(async () => {
4848
const { ComplexService } = window.api;
4949
return await ComplexService.complexTypes({

test/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ async function generate(input, output) {
77
await OpenAPI.generate({
88
input,
99
output,
10-
httpClient: OpenAPI.HttpClient.FETCH,
10+
httpClient: OpenAPI.HttpClient.AXIOS,
1111
useOptions: false,
1212
useUnionTypes: false,
1313
exportCore: true,

0 commit comments

Comments
 (0)