Skip to content

Commit 697f13b

Browse files
committed
rename withheader to setheader for clarity
1 parent e04bc14 commit 697f13b

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

examples/patch-example.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ try {
2020

2121
await k8sApi.patchNamespacedPod(
2222
{ name: res?.items?.[0]?.metadata?.name ?? '', namespace, body: patch },
23-
k8s.withHeaderOptions('Content-Type', 'application/json-patch+json'),
23+
k8s.setHeaderOptions('Content-Type', k8s.JsonPatch),
2424
);
2525

2626
console.log('Patched.');

examples/typescript/patch/patch-example.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CoreV1Api, KubeConfig, withHeaderOptions } from '@kubernetes/client-node';
1+
import { CoreV1Api, KubeConfig, setHeaderOptions, JsonPatch } from '@kubernetes/client-node';
22

33
const kc = new KubeConfig();
44
kc.loadFromDefault();
@@ -28,7 +28,7 @@ try {
2828
namespace: 'default',
2929
body: patch,
3030
},
31-
withHeaderOptions('Content-Type', JsonPatch),
31+
setHeaderOptions('Content-Type', JsonPatch),
3232
);
3333

3434
console.log('Patched.');

src/middleware.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { RequestContext, ResponseContext, ConfigurationOptions, Middleware } from './gen/index.js';
22
import { PromiseMiddleware } from './gen/middleware.js';
33

4-
// withHeaderMiddleware returns Middleware[] that sets a header value
5-
export function withHeaderMiddleware(key: string, value: string): Middleware[] {
4+
// setHeaderMiddleware returns Middleware[] that sets a header value
5+
export function setHeaderMiddleware(key: string, value: string): Middleware[] {
66
return [
77
{
88
pre: async (c: RequestContext) => {
@@ -17,12 +17,12 @@ export function withHeaderMiddleware(key: string, value: string): Middleware[] {
1717
}
1818

1919
// Returns ConfigurationOptions that set a header
20-
export function withHeaderOptions(
20+
export function setHeaderOptions(
2121
key: string,
2222
value: string,
2323
opt?: ConfigurationOptions<PromiseMiddleware>,
2424
): ConfigurationOptions<PromiseMiddleware> {
25-
const newMiddlware = withHeaderMiddleware(key, value);
25+
const newMiddlware = setHeaderMiddleware(key, value);
2626
const existingMiddlware = opt?.middleware || [];
2727
return {
2828
...opt,

0 commit comments

Comments
 (0)