In case the actual request-body is empty it seems not Content-Type
header is set by browsers.
Tested on a vm with stopping and starting a container via GUI
(/api2/extjs/nodes/<nodename>/lxc/<vmid>/status/stop)
fixes
f398a3d94bb5c798e1e1ea91113cd76648dd79eb
Reported-by: Friedrich Weber <f.weber@proxmox.com>
Reported-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
my $content;
if ($method eq 'POST' || $method eq 'PUT') {
- if ($reqstate->{request}->header('Content-Type') =~ 'application/json') {
+ my $request_ct = $reqstate->{request}->header('Content-Type');
+ if (defined($request_ct) && $request_ct =~ 'application/json') {
$headers->{'Content-Type'} = 'application/json';
$content = encode_json($params);
} else {