Skip to content

Patch actions fail due to 415 UnsupportedMediaType #30

@aletundo

Description

@aletundo

I encountered the problem with the patchCoreV1NamespacedService action, but probably the same bug affect all of the patch actions.

"result": {
    "status_code": 415,
    "data": {
      "status": "Failure",
      "kind": "Status",
      "code": 415,
      "apiVersion": "v1",
      "reason": "UnsupportedMediaType",
      "message": "the body of the request was in an unknown format - accepted media types include: application/json-patch+json, application/merge-patch+json, application/strategic-merge-patch+json",
      "metadata": {}
    }
  }

Accordingly to Kubernetes API Reference Documentation, the supported Content-Type header is application/strategic-merge-patch+json. I linked to version v1.7 since it is the older available version in the documentation, but the same value is specified for all the newer versions.

I made some tries specifying different arrangements of the header values. However, the only one accepted is application/strategic-merge-patch+json. Also, the application/json-patch+json requires an array of patches as the payload, which is impossible to be supplied since the body parameter is an object and not an array.

Furthermore, I would like to highlight another minor issue: at line 43, you format the args['url'] string providing also the body parameter, which is never used. I suppose it is a copy-and-paste refuse.

I did not verify all the patch-like actions, but looking at a couple of them, they are all affected.
Let me know if you confirm the bug and I can proceed with a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions