Skip to content

Commit 1be8402

Browse files
authored
Merge pull request #1038 from mstruebing/mstruebing/fix/casing-release-1.x
fix: casing of applyToHttpsOptions
2 parents 305c307 + 916249e commit 1be8402

File tree

7 files changed

+33
-33
lines changed

7 files changed

+33
-33
lines changed

src/config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ export class KubeConfig implements SecurityAuthentication {
147147
this.makePathsAbsolute(rootDirectory);
148148
}
149149

150-
public async applytoFetchOptions(opts: https.RequestOptions): Promise<RequestInit> {
151-
await this.applytoHTTPSOptions(opts);
150+
public async applyToFetchOptions(opts: https.RequestOptions): Promise<RequestInit> {
151+
await this.applyToHTTPSOptions(opts);
152152
const headers = new Headers();
153153
for (const [key, val] of Object.entries(opts.headers || {})) {
154154
if (Array.isArray(val)) {
@@ -170,7 +170,7 @@ export class KubeConfig implements SecurityAuthentication {
170170
};
171171
}
172172

173-
public async applytoHTTPSOptions(opts: https.RequestOptions): Promise<void> {
173+
public async applyToHTTPSOptions(opts: https.RequestOptions): Promise<void> {
174174
const user = this.getCurrentUser();
175175

176176
await this.applyOptions(opts);

src/config_test.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ describe('KubeConfig', () => {
254254
list: ['a', 'b'],
255255
},
256256
};
257-
const requestInit = await kc.applytoFetchOptions(opts);
257+
const requestInit = await kc.applyToFetchOptions(opts);
258258
const expectedCA = Buffer.from('CADATA2', 'utf-8');
259259
const expectedAgent = new https.Agent({
260260
ca: expectedCA,
@@ -279,7 +279,7 @@ describe('KubeConfig', () => {
279279
kc.loadFromFile(kcFileName);
280280

281281
const opts: https.RequestOptions = {};
282-
kc.applytoHTTPSOptions(opts);
282+
kc.applyToHTTPSOptions(opts);
283283

284284
expect(opts).to.deep.equal({
285285
headers: {},
@@ -300,7 +300,7 @@ describe('KubeConfig', () => {
300300
};
301301
const rc = new RequestContext(testServerName1, HttpMethod.GET);
302302
await kc.applySecurityAuthentication(rc);
303-
await kc.applytoHTTPSOptions(opts);
303+
await kc.applyToHTTPSOptions(opts);
304304
const expectedCA = Buffer.from('CADATA2', 'utf-8');
305305
const expectedAgent = new https.Agent({
306306
ca: expectedCA,
@@ -705,7 +705,7 @@ describe('KubeConfig', () => {
705705

706706
config.loadFromClusterAndUser({} as Cluster, { username: user, password: passwd } as User);
707707
const opts = {} as https.RequestOptions;
708-
await config.applytoHTTPSOptions(opts);
708+
await config.applyToHTTPSOptions(opts);
709709

710710
expect(opts.auth).to.equal(`${user}:${passwd}`);
711711
});
@@ -725,7 +725,7 @@ describe('KubeConfig', () => {
725725
);
726726
const opts = {} as RequestOptions;
727727

728-
await config.applytoHTTPSOptions(opts);
728+
await config.applyToHTTPSOptions(opts);
729729

730730
/* tslint:disable no-unused-expression*/
731731
expect(opts.auth).to.not.be.undefined;
@@ -740,7 +740,7 @@ describe('KubeConfig', () => {
740740
config.loadFromClusterAndUser({ skipTLSVerify: false } as Cluster, {} as User);
741741
const opts = {} as RequestOptions;
742742

743-
await config.applytoHTTPSOptions(opts);
743+
await config.applyToHTTPSOptions(opts);
744744

745745
expect(opts.rejectUnauthorized).to.equal(undefined);
746746
});
@@ -755,7 +755,7 @@ describe('KubeConfig', () => {
755755
);
756756
const opts = {} as RequestOptions;
757757

758-
await config.applytoHTTPSOptions(opts);
758+
await config.applyToHTTPSOptions(opts);
759759
expect(opts.headers).to.not.be.undefined;
760760
if (opts.headers) {
761761
expect(opts.headers.Authorization).to.equal(`Bearer ${token}`);
@@ -778,14 +778,14 @@ describe('KubeConfig', () => {
778778
);
779779
const opts = {} as RequestOptions;
780780

781-
await config.applytoHTTPSOptions(opts);
781+
await config.applyToHTTPSOptions(opts);
782782
expect(opts.headers).to.not.be.undefined;
783783
if (opts.headers) {
784784
expect(opts.headers.Authorization).to.equal(`Bearer ${token}`);
785785
}
786786
opts.headers = {};
787787
opts.headers.Host = 'foo.com';
788-
await config.applytoHTTPSOptions(opts);
788+
await config.applyToHTTPSOptions(opts);
789789
expect(opts.headers.Authorization).to.equal(`Bearer ${token}`);
790790
});
791791

@@ -805,7 +805,7 @@ describe('KubeConfig', () => {
805805
);
806806
const opts = {} as RequestOptions;
807807

808-
await config.applytoHTTPSOptions(opts);
808+
await config.applyToHTTPSOptions(opts);
809809
expect(opts.headers).to.not.be.undefined;
810810
if (opts.headers) {
811811
expect(opts.headers.Authorization).to.equal(`Bearer ${token}`);
@@ -828,7 +828,7 @@ describe('KubeConfig', () => {
828828
);
829829
const opts = {} as RequestOptions;
830830

831-
await config.applytoHTTPSOptions(opts);
831+
await config.applyToHTTPSOptions(opts);
832832
expect(opts.rejectUnauthorized).to.equal(false);
833833
});
834834

@@ -850,7 +850,7 @@ describe('KubeConfig', () => {
850850
);
851851
const opts = {} as RequestOptions;
852852

853-
await config.applytoHTTPSOptions(opts);
853+
await config.applyToHTTPSOptions(opts);
854854
expect(opts.rejectUnauthorized).to.equal(undefined);
855855
});
856856

@@ -869,7 +869,7 @@ describe('KubeConfig', () => {
869869
);
870870
const opts = {} as RequestOptions;
871871

872-
return expect(config.applytoHTTPSOptions(opts)).to.eventually.be.rejectedWith(
872+
return expect(config.applyToHTTPSOptions(opts)).to.eventually.be.rejectedWith(
873873
'Token is expired!',
874874
);
875875
});
@@ -890,7 +890,7 @@ describe('KubeConfig', () => {
890890
} as User,
891891
);
892892
const opts = {} as RequestOptions;
893-
return expect(config.applytoHTTPSOptions(opts)).to.eventually.be.rejectedWith(
893+
return expect(config.applyToHTTPSOptions(opts)).to.eventually.be.rejectedWith(
894894
/Failed to refresh token/,
895895
);
896896
});
@@ -919,7 +919,7 @@ describe('KubeConfig', () => {
919919
} as User,
920920
);
921921
const opts = {} as RequestOptions;
922-
await config.applytoHTTPSOptions(opts);
922+
await config.applyToHTTPSOptions(opts);
923923
expect(opts.headers).to.not.be.undefined;
924924
if (opts.headers) {
925925
expect(opts.headers.Authorization).to.equal(`Bearer ${token}`);
@@ -950,7 +950,7 @@ describe('KubeConfig', () => {
950950
} as User,
951951
);
952952
const opts = {} as RequestOptions;
953-
await config.applytoHTTPSOptions(opts);
953+
await config.applyToHTTPSOptions(opts);
954954
expect(opts.headers).to.not.be.undefined;
955955
if (opts.headers) {
956956
expect(opts.headers.Authorization).to.equal(`Bearer ${token}`);
@@ -980,7 +980,7 @@ describe('KubeConfig', () => {
980980
} as User,
981981
);
982982
const opts = {} as RequestOptions;
983-
await config.applytoHTTPSOptions(opts);
983+
await config.applyToHTTPSOptions(opts);
984984
expect(opts.headers).to.not.be.undefined;
985985
if (opts.headers) {
986986
expect(opts.headers.Authorization).to.equal(`Bearer ${token}`);
@@ -1009,7 +1009,7 @@ describe('KubeConfig', () => {
10091009
} as User,
10101010
);
10111011
const opts = {} as RequestOptions;
1012-
await config.applytoHTTPSOptions(opts);
1012+
await config.applyToHTTPSOptions(opts);
10131013
expect(opts.headers).to.not.be.undefined;
10141014
if (opts.headers) {
10151015
expect(opts.headers.Authorization).to.equal(`Bearer ${token}`);
@@ -1038,7 +1038,7 @@ describe('KubeConfig', () => {
10381038
} as User,
10391039
);
10401040
const opts = {} as RequestOptions;
1041-
await config.applytoHTTPSOptions(opts);
1041+
await config.applyToHTTPSOptions(opts);
10421042
expect(opts.headers).to.not.be.undefined;
10431043
if (opts.headers) {
10441044
expect(opts.headers.Authorization).to.equal(`Bearer ${token}`);
@@ -1074,7 +1074,7 @@ describe('KubeConfig', () => {
10741074
);
10751075
// TODO: inject the exec command here and validate env vars?
10761076
const opts = {} as RequestOptions;
1077-
await config.applytoHTTPSOptions(opts);
1077+
await config.applyToHTTPSOptions(opts);
10781078
expect(opts.headers).to.not.be.undefined;
10791079
if (opts.headers) {
10801080
expect(opts.headers.Authorization).to.equal(`Bearer ${token}`);
@@ -1110,7 +1110,7 @@ describe('KubeConfig', () => {
11101110
);
11111111
// TODO: inject the exec command here?
11121112
const opts = {} as RequestOptions;
1113-
await config.applytoHTTPSOptions(opts);
1113+
await config.applyToHTTPSOptions(opts);
11141114
expect(opts.headers).to.not.be.undefined;
11151115
if (opts.headers) {
11161116
expect(opts.headers.Authorization).to.equal(`Bearer ${token}`);
@@ -1141,7 +1141,7 @@ describe('KubeConfig', () => {
11411141
);
11421142
// TODO: inject the exec command here?
11431143
const opts = {} as RequestOptions;
1144-
await config.applytoHTTPSOptions(opts);
1144+
await config.applyToHTTPSOptions(opts);
11451145
expect(opts.headers).to.not.be.undefined;
11461146
if (opts.headers) {
11471147
expect(opts.headers.Authorization).to.equal(`Bearer ${token}`);
@@ -1173,7 +1173,7 @@ describe('KubeConfig', () => {
11731173
);
11741174
// TODO: inject the exec command here?
11751175
const opts = {} as RequestOptions;
1176-
await config.applytoHTTPSOptions(opts);
1176+
await config.applyToHTTPSOptions(opts);
11771177
const execAuthenticator = (KubeConfig as any).authenticators.find(
11781178
(authenticator) => authenticator instanceof ExecAuth,
11791179
);
@@ -1194,7 +1194,7 @@ describe('KubeConfig', () => {
11941194
} as User,
11951195
);
11961196
const opts = {} as RequestOptions;
1197-
return expect(config.applytoHTTPSOptions(opts)).to.eventually.be.rejectedWith(
1197+
return expect(config.applyToHTTPSOptions(opts)).to.eventually.be.rejectedWith(
11981198
'No command was specified for exec authProvider!',
11991199
);
12001200
});
@@ -1493,7 +1493,7 @@ describe('KubeConfig', () => {
14931493

14941494
it('should apply to request', async () => {
14951495
const opts = {} as RequestOptions;
1496-
await emptyConfig.applytoHTTPSOptions(opts);
1496+
await emptyConfig.applyToHTTPSOptions(opts);
14971497
});
14981498
});
14991499

src/log.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export class Log {
120120
searchParams.set('container', containerName);
121121
AddOptionsToSearchParams(options, searchParams);
122122

123-
const requestInit = await this.config.applytoFetchOptions({});
123+
const requestInit = await this.config.applyToFetchOptions({});
124124

125125
const controller = new AbortControllerCtor();
126126
requestInit.signal = controller.signal;

src/metrics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class Metrics {
8484

8585
const requestURL = cluster.server + path;
8686

87-
const requestInit = await this.config.applytoFetchOptions({});
87+
const requestInit = await this.config.applyToFetchOptions({});
8888
requestInit.method = 'GET';
8989

9090
return fetch(requestURL, requestInit)

src/proto-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class ProtoClient {
1414
hostname: u.hostname,
1515
protocol: u.protocol,
1616
};
17-
await this.config.applytoHTTPSOptions(options);
17+
await this.config.applyToHTTPSOptions(options);
1818
const req = http.request(options);
1919

2020
const result = await new Promise<any>((resolve, reject) => {

src/watch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class Watch {
4141
}
4242
}
4343

44-
const requestInit = await this.config.applytoFetchOptions({});
44+
const requestInit = await this.config.applyToFetchOptions({});
4545

4646
const controller = new AbortControllerCtor();
4747
requestInit.signal = controller.signal;

src/web-socket-handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ export class WebSocketHandler implements WebSocketInterface {
166166

167167
const opts: WebSocket.ClientOptions = {};
168168

169-
await this.config.applytoHTTPSOptions(opts);
169+
await this.config.applyToHTTPSOptions(opts);
170170

171171
return await new Promise<WebSocket>((resolve, reject) => {
172172
const client = this.socketFactory

0 commit comments

Comments
 (0)