Minor tweaks for ESM strict mode 路 sindresorhus/got@6c7ebab (original) (raw)
1
1
`import {URL} from 'node:url';
`
2
2
`import https from 'node:https';
`
3
``
`-
import axios from 'axios';
`
``
3
`+
/// import axios from 'axios';
`
4
4
`import Benchmark from 'benchmark';
`
5
5
`import fetch from 'node-fetch';
`
6
6
`import request from 'request';
`
`@@ -41,18 +41,18 @@ const fetchOptions = {
`
41
41
`agent: httpsAgent,
`
42
42
`};
`
43
43
``
44
``
`-
const axiosOptions = {
`
45
``
`-
url: urlString,
`
46
``
`-
httpsAgent,
`
47
``
`-
https: {
`
48
``
`-
rejectUnauthorized: false,
`
49
``
`-
},
`
50
``
`-
};
`
``
44
`+
/// const axiosOptions = {
`
``
45
`+
// url: urlString,
`
``
46
`+
// httpsAgent,
`
``
47
`+
// https: {
`
``
48
`+
// rejectUnauthorized: false,
`
``
49
`+
// },
`
``
50
`+
// };
`
51
51
``
52
``
`-
const axiosStreamOptions: typeof axiosOptions & {responseType: 'stream'} = {
`
53
``
`-
...axiosOptions,
`
54
``
`-
responseType: 'stream',
`
55
``
`-
};
`
``
52
`+
// const axiosStreamOptions: typeof axiosOptions & {responseType: 'stream'} = {
`
``
53
`+
// ...axiosOptions,
`
``
54
`+
// responseType: 'stream',
`
``
55
`+
// };
`
56
56
``
57
57
`const httpsOptions = {
`
58
58
`https: {
`
`@@ -136,19 +136,23 @@ suite.add('got - promise', {
`
136
136
`}).add('axios - promise', {
`
137
137
`defer: true,
`
138
138
`async fn(deferred: {resolve: () => void}) {
`
139
``
`-
await axios.request(axiosOptions);
`
``
139
`+
// Disabled until it has correct types.
`
``
140
`+
// await axios.request(axiosOptions);
`
140
141
`deferred.resolve();
`
141
142
`},
`
142
143
`}).add('axios - stream', {
`
143
144
`defer: true,
`
144
145
`async fn(deferred: {resolve: () => void}) {
`
145
``
`-
const result = await axios.request(axiosStreamOptions);
`
146
``
`-
const {data}: any = result;
`
``
146
`+
// Disabled until it has correct types.
`
``
147
`+
// const result = await axios.request(axiosStreamOptions);
`
``
148
`+
// const {data}: any = result;
`
147
149
``
148
``
`-
data.resume();
`
149
``
`-
data.once('end', () => {
`
150
``
`-
deferred.resolve();
`
151
``
`-
});
`
``
150
`+
// data.resume();
`
``
151
`+
// data.once('end', () => {
`
``
152
`+
// deferred.resolve();
`
``
153
`+
// });
`
``
154
+
``
155
`+
deferred.resolve();
`
152
156
`},
`
153
157
`}).add('https - stream', {
`
154
158
`defer: true,
`