@@ -322,9 +322,13 @@ def _create_ad_serialize(
322322 )
323323
324324 # set the HTTP header `Content-Type`
325+ # Only emit Content-Type when there's actually a body/form/file to send.
326+ # PVE/PMG Perl HTTP server rejects empty bodies with Content-Type:
327+ # application/json ("malformed JSON string"); other Proxmox products are
328+ # equally fussy. An explicit `_content_type` override always wins.
325329 if _content_type :
326330 _header_params ['Content-Type' ] = _content_type
327- else :
331+ elif _body_params is not None or _form_params or _files :
328332 _default_content_type = (
329333 self .api_client .select_header_content_type (
330334 [
@@ -620,9 +624,13 @@ def _create_ldap_serialize(
620624 )
621625
622626 # set the HTTP header `Content-Type`
627+ # Only emit Content-Type when there's actually a body/form/file to send.
628+ # PVE/PMG Perl HTTP server rejects empty bodies with Content-Type:
629+ # application/json ("malformed JSON string"); other Proxmox products are
630+ # equally fussy. An explicit `_content_type` override always wins.
623631 if _content_type :
624632 _header_params ['Content-Type' ] = _content_type
625- else :
633+ elif _body_params is not None or _form_params or _files :
626634 _default_content_type = (
627635 self .api_client .select_header_content_type (
628636 [
@@ -918,9 +926,13 @@ def _create_openid_serialize(
918926 )
919927
920928 # set the HTTP header `Content-Type`
929+ # Only emit Content-Type when there's actually a body/form/file to send.
930+ # PVE/PMG Perl HTTP server rejects empty bodies with Content-Type:
931+ # application/json ("malformed JSON string"); other Proxmox products are
932+ # equally fussy. An explicit `_content_type` override always wins.
921933 if _content_type :
922934 _header_params ['Content-Type' ] = _content_type
923- else :
935+ elif _body_params is not None or _form_params or _files :
924936 _default_content_type = (
925937 self .api_client .select_header_content_type (
926938 [
@@ -4600,9 +4612,13 @@ def _update_ad_serialize(
46004612 )
46014613
46024614 # set the HTTP header `Content-Type`
4615+ # Only emit Content-Type when there's actually a body/form/file to send.
4616+ # PVE/PMG Perl HTTP server rejects empty bodies with Content-Type:
4617+ # application/json ("malformed JSON string"); other Proxmox products are
4618+ # equally fussy. An explicit `_content_type` override always wins.
46034619 if _content_type :
46044620 _header_params ['Content-Type' ] = _content_type
4605- else :
4621+ elif _body_params is not None or _form_params or _files :
46064622 _default_content_type = (
46074623 self .api_client .select_header_content_type (
46084624 [
@@ -4913,9 +4929,13 @@ def _update_ldap_serialize(
49134929 )
49144930
49154931 # set the HTTP header `Content-Type`
4932+ # Only emit Content-Type when there's actually a body/form/file to send.
4933+ # PVE/PMG Perl HTTP server rejects empty bodies with Content-Type:
4934+ # application/json ("malformed JSON string"); other Proxmox products are
4935+ # equally fussy. An explicit `_content_type` override always wins.
49164936 if _content_type :
49174937 _header_params ['Content-Type' ] = _content_type
4918- else :
4938+ elif _body_params is not None or _form_params or _files :
49194939 _default_content_type = (
49204940 self .api_client .select_header_content_type (
49214941 [
@@ -5226,9 +5246,13 @@ def _update_openid_serialize(
52265246 )
52275247
52285248 # set the HTTP header `Content-Type`
5249+ # Only emit Content-Type when there's actually a body/form/file to send.
5250+ # PVE/PMG Perl HTTP server rejects empty bodies with Content-Type:
5251+ # application/json ("malformed JSON string"); other Proxmox products are
5252+ # equally fussy. An explicit `_content_type` override always wins.
52295253 if _content_type :
52305254 _header_params ['Content-Type' ] = _content_type
5231- else :
5255+ elif _body_params is not None or _form_params or _files :
52325256 _default_content_type = (
52335257 self .api_client .select_header_content_type (
52345258 [
@@ -5524,9 +5548,13 @@ def _update_webauthn_serialize(
55245548 )
55255549
55265550 # set the HTTP header `Content-Type`
5551+ # Only emit Content-Type when there's actually a body/form/file to send.
5552+ # PVE/PMG Perl HTTP server rejects empty bodies with Content-Type:
5553+ # application/json ("malformed JSON string"); other Proxmox products are
5554+ # equally fussy. An explicit `_content_type` override always wins.
55275555 if _content_type :
55285556 _header_params ['Content-Type' ] = _content_type
5529- else :
5557+ elif _body_params is not None or _form_params or _files :
55305558 _default_content_type = (
55315559 self .api_client .select_header_content_type (
55325560 [
0 commit comments