You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to patch a resource with a request body in JSON Merge Patch, RFC 7386 format. However, even if I specify the Content-Type application/merge-patch+json in a PromiseMiddlewareWrapper, add it into a ServerConfiguration and then use the configuration in the client method k8sApi.patchNamespacedPod({xxx}, configuration), the error still occurs:
ApiException [Error]: HTTP-Code: 400
Message: Unknown API Status Code!
Body: "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Failure\",\"message\":\"error decoding patch: json: cannot unmarshal object into Go value of type []handlers.jsonPatchOp\",\"reason\":\"BadRequest\",\"code\":400}\n"
Headers: {"audit-id":"f2f1b40e-9d4a-49cf-af2b-989bed7de17e","cache-control":"no-cache, private","connection":"close","content-length":"211","content-type":"application/json","date":"Tue, 14 Jan 2025 02:17:01 GMT","x-kubernetes-pf-flowschema-uid":"93068417-329d-4e0f-9768-8a2b6794f954","x-kubernetes-pf-prioritylevel-uid":"f7dc9ee7-016c-48fa-afc3-77112540d77f"}
at CoreV1ApiResponseProcessor.patchNamespacedPodWithHttpInfo (/Users/I584817/Downloads/js-examples/node_modules/@kubernetes/client-node/dist/gen/apis/CoreV1Api.js:15722:15)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async file:///Users/XXX/Downloads/js-examples/merge-patch-example.js:46:5 {
code: 400,
body: '{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"error decoding patch: json: cannot unmarshal object into Go value of type []handlers.jsonPatchOp","reason":"BadRequest","code":400}\n',
headers: {
'audit-id': 'f2f1b40e-9d4a-49cf-af2b-989bed7de17e',
'cache-control': 'no-cache, private',
connection: 'close',
'content-length': '211',
'content-type': 'application/json',
date: 'Tue, 14 Jan 2025 02:17:01 GMT',
'x-kubernetes-pf-flowschema-uid': '93068417-329d-4e0f-9768-8a2b6794f954',
'x-kubernetes-pf-prioritylevel-uid': 'f7dc9ee7-016c-48fa-afc3-77112540d77f'
}
}
Please find my code in the example code below.
I tried to debug, and it seems that the pre function in the PromiseMiddlewareWrapper does not be executed.
Describe the bug
I would like to patch a resource with a request body in JSON Merge Patch, RFC 7386 format. However, even if I specify the Content-Type
application/merge-patch+json
in aPromiseMiddlewareWrapper
, add it into aServerConfiguration
and then use the configuration in the client methodk8sApi.patchNamespacedPod({xxx}, configuration)
, the error still occurs:Please find my code in the example code below.
I tried to debug, and it seems that the
pre
function in thePromiseMiddlewareWrapper
does not be executed.I saw a Patch related issue [release-1.x] Patch namespace secret trigger an error due to unsupported media type, but it does not solve this issue.
Client Version
1.0.0
Server Version
1.31.0
To Reproduce
Save the below example code into file
merge-patch-example.js
, then execute the following commands.Expected behavior
The server should not raise any error.
Example Code
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: