@@ -585,9 +585,13 @@ def _add_plugin_serialize(
585585 )
586586
587587 # set the HTTP header `Content-Type`
588+ # Only emit Content-Type when there's actually a body/form/file to send.
589+ # PVE/PMG Perl HTTP server rejects empty bodies with Content-Type:
590+ # application/json ("malformed JSON string"); other Proxmox products are
591+ # equally fussy. An explicit `_content_type` override always wins.
588592 if _content_type :
589593 _header_params ['Content-Type' ] = _content_type
590- else :
594+ elif _body_params is not None or _form_params or _files :
591595 _default_content_type = (
592596 self .api_client .select_header_content_type (
593597 [
@@ -3701,9 +3705,13 @@ def _register_account_serialize(
37013705 )
37023706
37033707 # set the HTTP header `Content-Type`
3708+ # Only emit Content-Type when there's actually a body/form/file to send.
3709+ # PVE/PMG Perl HTTP server rejects empty bodies with Content-Type:
3710+ # application/json ("malformed JSON string"); other Proxmox products are
3711+ # equally fussy. An explicit `_content_type` override always wins.
37043712 if _content_type :
37053713 _header_params ['Content-Type' ] = _content_type
3706- else :
3714+ elif _body_params is not None or _form_params or _files :
37073715 _default_content_type = (
37083716 self .api_client .select_header_content_type (
37093717 [
@@ -4014,9 +4022,13 @@ def _update_account_serialize(
40144022 )
40154023
40164024 # set the HTTP header `Content-Type`
4025+ # Only emit Content-Type when there's actually a body/form/file to send.
4026+ # PVE/PMG Perl HTTP server rejects empty bodies with Content-Type:
4027+ # application/json ("malformed JSON string"); other Proxmox products are
4028+ # equally fussy. An explicit `_content_type` override always wins.
40174029 if _content_type :
40184030 _header_params ['Content-Type' ] = _content_type
4019- else :
4031+ elif _body_params is not None or _form_params or _files :
40204032 _default_content_type = (
40214033 self .api_client .select_header_content_type (
40224034 [
@@ -4327,9 +4339,13 @@ def _update_plugin_serialize(
43274339 )
43284340
43294341 # set the HTTP header `Content-Type`
4342+ # Only emit Content-Type when there's actually a body/form/file to send.
4343+ # PVE/PMG Perl HTTP server rejects empty bodies with Content-Type:
4344+ # application/json ("malformed JSON string"); other Proxmox products are
4345+ # equally fussy. An explicit `_content_type` override always wins.
43304346 if _content_type :
43314347 _header_params ['Content-Type' ] = _content_type
4332- else :
4348+ elif _body_params is not None or _form_params or _files :
43334349 _default_content_type = (
43344350 self .api_client .select_header_content_type (
43354351 [
0 commit comments