javascript icon indicating copy to clipboard operation
javascript copied to clipboard

1.0.0-rc4 Example for overriding the content-type header of patching operations do not work

Open tugtugtug opened this issue 6 months ago • 5 comments

Describe the bug The configuration passed into the patching APIs do not honor the middleware overrides. The generated code does not even look at the passed in configuration for the middlewares, it only looks at the middlewares of its member configuration object. e.g.

    patchNamespacedStatefulSetWithHttpInfo(name, namespace, body, pretty, dryRun, fieldManager, fieldValidation, force, _options) {
        const requestContextPromise = this.requestFactory.patchNamespacedStatefulSet(name, namespace, body, pretty, dryRun, fieldManager, fieldValidation, force, _options);
        // build promise chain
        let middlewarePreObservable = (0, rxjsStub_1.from)(requestContextPromise);
        for (let middleware of this.configuration.middleware) {
            middlewarePreObservable = middlewarePreObservable.pipe((0, rxjsStub_2.mergeMap)((ctx) => middleware.pre(ctx)));
        }

** Client Version ** 1.0.0-rc4

** Server Version ** 1.25.1

To Reproduce Steps to reproduce the behavior:

  • make a call to patchNamespacedStatefulSet with the configuration overriding with the middleware.

Expected behavior The middleware should be called to override the request.

** Example Code** see https://github.com/kubernetes-client/javascript/blob/62e5ab1701cb5659656f1941ef11eb748e626c25/examples/patch-example.js

Environment (please complete the following information):

  • OS: [Ubuntu 22.04]
  • NodeJS Version [18]
  • Cloud runtime [NA]

Additional context Related to https://github.com/kubernetes-client/javascript/issues/1398

Workaround

		return createConfiguration({
			baseServer: baseServerConfig,
			middleware: [mw],
			authMethods: {
				default: {
					applySecurityAuthentication: async (req) => {
						await mw.pre(req).toPromise();
						await kc.applySecurityAuthentication(req);
					}
				},
			},
		});

tugtugtug avatar Jan 04 '24 21:01 tugtugtug