diff --git a/packages/kubekit-client/package.json b/packages/kubekit-client/package.json index 73878074..e4b10640 100644 --- a/packages/kubekit-client/package.json +++ b/packages/kubekit-client/package.json @@ -1,6 +1,6 @@ { "name": "@kubekit/client", - "version": "0.2.30", + "version": "0.2.31", "main": "dist/index.js", "types": "dist/index.d.ts", "author": "kahirokunn", diff --git a/packages/kubekit-client/src/client/index.ts b/packages/kubekit-client/src/client/index.ts index 6ce8440b..8b22cb51 100644 --- a/packages/kubekit-client/src/client/index.ts +++ b/packages/kubekit-client/src/client/index.ts @@ -254,18 +254,20 @@ export async function apiClient( let baseUrl = `${httpsOptions.protocol}//${host}`; const searchParameters = toSearchParameters(params); if (searchParameters.size > 0) { - // https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/3157-watch-list/README.md - // TODO: defaultのfeature flagがtrueになったら、watchの場合は自動で以下の2つのparamsを追加してあげたい - // sendInitialEvents: true, - // resourceVersionMatch: "NotOlderThan" - if (isWatch) { - params = { - ...params, - allowWatchBookmarks: true, - }; + // https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/3157-watch-list/README.md + // TODO: defaultのfeature flagがtrueになったら、watchの場合は自動で以下の2つのparamsを追加してあげたい + // sendInitialEvents: true, + // resourceVersionMatch: "NotOlderThan" + baseUrl += + (baseUrl.includes('?') ? '&' : '?') + + toSearchParameters({ + ...params, + allowWatchBookmarks: true, + }); + } else { + baseUrl += (baseUrl.includes('?') ? '&' : '?') + searchParameters; } - baseUrl += (baseUrl.includes('?') ? '&' : '?') + searchParameters; } const url = new URL(baseUrl); if (httpsOptions.port) {