### What happened?

I was writing a method to patch a CRD using the client-go rest client:

```
err := c.restClient.
		Patch(types.MergePatchType).
		Resource(MySuperAwesomeResource).
		SubResource("status").
		Name(name).
		Body(superAwesomeResourceObject).
		Do(ctx).
		Into(result)
```

and was surprised to receive an error:

```
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
```



### What did you expect to happen?

The patch to not fail due to an incorrect Content-Type, since I set it via `Patch(types.MergePatchType)`.

### How can we reproduce it (as minimally and precisely as possible)?

Using the client-go rest client, try to patch a resource by passing a runtime.Object to the `Body()` method.

### Anything else we need to know?

Here's what I think is happening:

The `Patch()` method [sets](https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/client-go/rest/client.go#L186) the Content-Type header.

But passing a k8s runtime object to `Body()` [overwrites](https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/client-go/rest/request.go#L478) the header with whatever Content-Type is set in the `ClientContentConfig` if (and only if) the passed object is a k8s runtime object. This defaults to `application/json`, and I think is correct for HTTP methods that aren't `Patch()`.

If one gates `Body()`'s setting of that header to not do that for the `PATCH` verb:

```
if r.verb != "PATCH" {
	r.SetHeader("Content-Type", r.c.content.ContentType)
}
```

then things work.

One can also call `SetHeader` after `Body()`:

```
err := c.restClient.
		Patch(types.MergePatchType).
		Resource(MySuperAwesomeResource).
		SubResource("status").
		Name(name).
		Body(superAwesomeResourceObject).
		SetHeader("Content-Type", string(types.MergePatchType)).
		Do(ctx).
		Into(result)
```

and things work.


IDK if I'm doing it wrong here, but this feels more like a bug and less like operator error?

### Kubernetes version

<details>

```console
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.3", GitCommit:"25b4e43193bcda6c7328a6d147b1fb73a33f1598", GitTreeState:"clean", BuildDate:"2023-06-14T09:53:42Z", GoVersion:"go1.20.5", Compiler:"gc", Platform:"linux/amd64"}
Client Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.3", GitCommit:"25b4e43193bcda6c7328a6d147b1fb73a33f1598", GitTreeState:"clean", BuildDate:"2023-06-14T09:53:42Z", GoVersion:"go1.20.5", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v5.0.1
Server Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.3", GitCommit:"25b4e43193bcda6c7328a6d147b1fb73a33f1598", GitTreeState:"clean", BuildDate:"2023-06-15T00:36:28Z", GoVersion:"go1.20.5", Compiler:"gc", Platform:"linux/amd64"}```

</details>


### Cloud provider

<details>
self
</details>


### OS version

<details>

```console
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
```

</details>


### Install tools

<details>

</details>


### Container runtime (CRI) and version (if applicable)

<details>

</details>


### Related plugins (CNI, CSI, ...) and versions (if applicable)

<details>

</details>

Content-Type for RestClient Patch() is Overwritten By Body() Method 
This is a GitHub Issue
repo:kubernetes
owner:kubernetes
Title : Content-Type for RestClient Patch() is Overwritten By Body() Method 
Issue date:

--- start body ---
### What happened?

I was writing a method to patch a CRD using the client-go rest client:

```
err := c.restClient.
		Patch(types.MergePatchType).
		Resource(MySuperAwesomeResource).
		SubResource("status").
		Name(name).
		Body(superAwesomeResourceObject).
		Do(ctx).
		Into(result)
```

and was surprised to receive an error:

```
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
```



### What did you expect to happen?

The patch to not fail due to an incorrect Content-Type, since I set it via `Patch(types.MergePatchType)`.

### How can we reproduce it (as minimally and precisely as possible)?

Using the client-go rest client, try to patch a resource by passing a runtime.Object to the `Body()` method.

### Anything else we need to know?

Here's what I think is happening:

The `Patch()` method [sets](https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/client-go/rest/client.go#L186) the Content-Type header.

But passing a k8s runtime object to `Body()` [overwrites](https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/client-go/rest/request.go#L478) the header with whatever Content-Type is set in the `ClientContentConfig` if (and only if) the passed object is a k8s runtime object. This defaults to `application/json`, and I think is correct for HTTP methods that aren't `Patch()`.

If one gates `Body()`'s setting of that header to not do that for the `PATCH` verb:

```
if r.verb != "PATCH" {
	r.SetHeader("Content-Type", r.c.content.ContentType)
}
```

then things work.

One can also call `SetHeader` after `Body()`:

```
err := c.restClient.
		Patch(types.MergePatchType).
		Resource(MySuperAwesomeResource).
		SubResource("status").
		Name(name).
		Body(superAwesomeResourceObject).
		SetHeader("Content-Type", string(types.MergePatchType)).
		Do(ctx).
		Into(result)
```

and things work.


IDK if I'm doing it wrong here, but this feels more like a bug and less like operator error?

### Kubernetes version

<details>

```console
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.3", GitCommit:"25b4e43193bcda6c7328a6d147b1fb73a33f1598", GitTreeState:"clean", BuildDate:"2023-06-14T09:53:42Z", GoVersion:"go1.20.5", Compiler:"gc", Platform:"linux/amd64"}
Client Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.3", GitCommit:"25b4e43193bcda6c7328a6d147b1fb73a33f1598", GitTreeState:"clean", BuildDate:"2023-06-14T09:53:42Z", GoVersion:"go1.20.5", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v5.0.1
Server Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.3", GitCommit:"25b4e43193bcda6c7328a6d147b1fb73a33f1598", GitTreeState:"clean", BuildDate:"2023-06-15T00:36:28Z", GoVersion:"go1.20.5", Compiler:"gc", Platform:"linux/amd64"}```

</details>


### Cloud provider

<details>
self
</details>


### OS version

<details>

```console
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
```

</details>


### Install tools

<details>

</details>


### Container runtime (CRI) and version (if applicable)

<details>

</details>


### Related plugins (CNI, CSI, ...) and versions (if applicable)

<details>

</details>

--- end body ---
