@@ -305,9 +305,13 @@ def _create_domains_serialize(
305305 )
306306
307307 # set the HTTP header `Content-Type`
308+ # Only emit Content-Type when there's actually a body/form/file to send.
309+ # PVE/PMG Perl HTTP server rejects empty bodies with Content-Type:
310+ # application/json ("malformed JSON string"); other Proxmox products are
311+ # equally fussy. An explicit `_content_type` override always wins.
308312 if _content_type :
309313 _header_params ['Content-Type' ] = _content_type
310- else :
314+ elif _body_params is not None or _form_params or _files :
311315 _default_content_type = (
312316 self .api_client .select_header_content_type (
313317 [
@@ -1452,9 +1456,13 @@ def _sync_serialize(
14521456 )
14531457
14541458 # set the HTTP header `Content-Type`
1459+ # Only emit Content-Type when there's actually a body/form/file to send.
1460+ # PVE/PMG Perl HTTP server rejects empty bodies with Content-Type:
1461+ # application/json ("malformed JSON string"); other Proxmox products are
1462+ # equally fussy. An explicit `_content_type` override always wins.
14551463 if _content_type :
14561464 _header_params ['Content-Type' ] = _content_type
1457- else :
1465+ elif _body_params is not None or _form_params or _files :
14581466 _default_content_type = (
14591467 self .api_client .select_header_content_type (
14601468 [
@@ -1765,9 +1773,13 @@ def _update_domains_serialize(
17651773 )
17661774
17671775 # set the HTTP header `Content-Type`
1776+ # Only emit Content-Type when there's actually a body/form/file to send.
1777+ # PVE/PMG Perl HTTP server rejects empty bodies with Content-Type:
1778+ # application/json ("malformed JSON string"); other Proxmox products are
1779+ # equally fussy. An explicit `_content_type` override always wins.
17681780 if _content_type :
17691781 _header_params ['Content-Type' ] = _content_type
1770- else :
1782+ elif _body_params is not None or _form_params or _files :
17711783 _default_content_type = (
17721784 self .api_client .select_header_content_type (
17731785 [
0 commit comments