File tree 13 files changed +1199
-1112
lines changed
Filter options
13 files changed +1199
-1112
lines changed
Original file line number Diff line number Diff line change 83
83
"eslint-plugin-erasable-syntax-only" : " ^0.3.0" ,
84
84
"husky" : " ^9.0.6" ,
85
85
"mock-fs" : " ^5.2.0" ,
86
- "nock" : " ^14.0.2 " ,
86
+ "nock" : " ^13.2.9 " ,
87
87
"prettier" : " ^3.0.0" ,
88
88
"pretty-quick" : " ^4.0.0" ,
89
89
"ts-mockito" : " ^2.3.1" ,
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import yaml from 'js-yaml';
4
4
import net from 'node:net' ;
5
5
import path from 'node:path' ;
6
6
7
+ import { Headers , RequestInit } from 'node-fetch' ;
7
8
import { RequestContext } from './api.js' ;
8
9
import { Authenticator } from './auth.js' ;
9
10
import { AzureAuth } from './azure_auth.js' ;
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import { fileURLToPath } from 'node:url';
10
10
import mockfs from 'mock-fs' ;
11
11
12
12
import { Authenticator } from './auth.js' ;
13
+ import { Headers } from 'node-fetch' ;
13
14
import { HttpMethod } from './index.js' ;
14
15
import { assertRequestAgentsEqual , assertRequestOptionsEqual } from './test/match-buffer.js' ;
15
16
import { CoreV1Api , RequestContext } from './api.js' ;
@@ -294,7 +295,7 @@ describe('KubeConfig', () => {
294
295
strictEqual ( headers . get ( 'list' ) , 'a, b' ) ;
295
296
strictEqual ( headers . get ( 'number' ) , '5' ) ;
296
297
strictEqual ( headers . get ( 'string' ) , 'str' ) ;
297
- assertRequestAgentsEqual ( ( requestInit as any ) . agent as Agent , expectedAgent ) ;
298
+ assertRequestAgentsEqual ( requestInit . agent as Agent , expectedAgent ) ;
298
299
} ) ;
299
300
} ) ;
300
301
Original file line number Diff line number Diff line change
1
+ import fetch from 'node-fetch' ;
1
2
import { KubeConfig } from './config.js' ;
2
3
import { RequestOptions } from 'node:https' ;
3
4
Original file line number Diff line number Diff line change @@ -18,3 +18,6 @@ export * from './health.js';
18
18
export * from './middleware.js' ;
19
19
export * from './patch.js' ;
20
20
export { type ConfigOptions , type User , type Cluster , type Context } from './config_types.js' ;
21
+
22
+ // Export FetchError so that instanceof checks in user code will definitely use the same instance
23
+ export { FetchError } from 'node-fetch' ;
Original file line number Diff line number Diff line change 1
- import { Readable , Writable } from 'node:stream' ;
1
+ import fetch from 'node-fetch' ;
2
+ import { Writable } from 'node:stream' ;
2
3
import { ApiException } from './api.js' ;
3
4
import { KubeConfig } from './config.js' ;
4
5
import { V1Status } from './gen/index.js' ;
@@ -139,7 +140,7 @@ export class Log {
139
140
const status = response . status ;
140
141
if ( status === 200 ) {
141
142
// TODO: the follow search param still has the stream close prematurely based on my testing
142
- Readable . fromWeb ( response . body ! ) . pipe ( stream ) ;
143
+ response . body ! . pipe ( stream ) ;
143
144
} else if ( status === 500 ) {
144
145
const v1status = ( await response . json ( ) ) as V1Status ;
145
146
const v1code = v1status . code ;
Original file line number Diff line number Diff line change
1
+ import fetch from 'node-fetch' ;
1
2
import { KubeConfig } from './config.js' ;
2
3
import { ApiException , V1Status } from './gen/index.js' ;
3
4
import { normalizeResponseHeaders } from './util.js' ;
Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ describe('Metrics', () => {
149
149
const metricsClient = new Metrics ( kc ) ;
150
150
await rejects ( metricsClient . getPodMetrics ( ) , ( err ) => {
151
151
ok ( err instanceof ApiException ) ;
152
- match ( err . message , / E r r o r o c c u r r e d i n m e t r i c s r e q u e s t : f e t c h f a i l e d / ) ;
152
+ match ( err . message , / c o n n e c t E C O N N R E F U S E D 1 2 7 . 0 . 0 . 1 : 5 1 0 1 1 / ) ;
153
153
return true ;
154
154
} ) ;
155
155
} ) ;
Original file line number Diff line number Diff line change
1
+ import { Response } from 'node-fetch' ;
1
2
import { CoreV1Api , V1Container , V1Pod } from './gen/index.js' ;
2
3
3
4
export async function podsForNode ( api : CoreV1Api , nodeName : string ) : Promise < V1Pod [ ] > {
Original file line number Diff line number Diff line change 1
1
import { describe , it } from 'node:test' ;
2
2
import { deepStrictEqual , strictEqual , throws } from 'node:assert' ;
3
+ import { Response } from 'node-fetch' ;
3
4
import { CoreV1Api , V1Container , V1Pod } from './api.js' ;
4
5
import {
5
6
normalizeResponseHeaders ,
Original file line number Diff line number Diff line change 1
1
import { STATUS_CODES } from 'node:http' ;
2
2
import { createInterface } from 'node:readline' ;
3
- import { Readable } from 'node:stream ' ;
3
+ import fetch from 'node-fetch ' ;
4
4
import { KubeConfig } from './config.js' ;
5
5
6
6
export class Watch {
@@ -55,7 +55,7 @@ export class Watch {
55
55
const response = await fetch ( watchURL , requestInit ) ;
56
56
57
57
if ( response . status === 200 ) {
58
- const body = Readable . fromWeb ( response . body ! ) ;
58
+ const body = response . body ! ;
59
59
60
60
body . on ( 'error' , doneCallOnce ) ;
61
61
body . on ( 'close' , ( ) => doneCallOnce ( null ) ) ;
Original file line number Diff line number Diff line change 15
15
"forceConsistentCasingInFileNames" : true ,
16
16
"importHelpers" : true ,
17
17
"skipLibCheck" : true ,
18
- "esModuleInterop" : true
18
+ "esModuleInterop" : true ,
19
+ "useDefineForClassFields" : false
19
20
// enable this in the future
20
21
// "declarationMap": true
21
22
},
You can’t perform that action at this time.
0 commit comments