Skip to content

The body of the request was in an unknown format #2632

@1993alexey

Description

@1993alexey

Describe the bug
When sending patchNamespacedCustomObject in azure AKS, the request headers contain 2 separate headers for content-type, causing the following issue
{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"the body of the request was in an unknown format - accepted media types include: application/json-patch+json, application/merge-patch+json, application/apply-patch+yaml","reason":"UnsupportedMediaType","code":415}

Header 1: Content-Type: application/json-patch+json
Header 2: Content-type: application/json-patch+json

The only difference is the lower and upper case letter t in the header name. Deleting either header fixes the issue

Client Version
v1.32.3

Server Version
v1.31.5

To Reproduce
This does not happen in AWS EKS clusters. For Azure, send a patchNamespacedCustomObject request with application/json-patch+json patch strategy.

Expected behavior
A successful request. No duplicate headers.

Example Code

    const options = setHeaderOptions('Content-type', PatchStrategy.JsonPatch)
    const patch = [
      {
        op: 'replace',
        path: '/spec/replicas',
        value: 0,
      },
    ]
        this.customObjectsApi.patchNamespacedCustomObject(
          { group: 'argoproj.io', version: 'v1alpha1', namespace: this.namespace, plural: 'rollouts', name: rolloutName, body: patch },
          options
        )

Environment (please complete the following information):

  • OS: [MacOS]
  • Node.js version [20]
  • Cloud runtime [Local development]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions