always send Content-Type: application/json

This commit is contained in:
ralf 2023-08-03 09:00:15 +02:00
parent afdca98629
commit fb87f5f173

View File

@ -54,6 +54,7 @@ class ApiHandler extends Api\CalDAV\Handler
$prefix = '/'.Api\Accounts::id2name($user); $prefix = '/'.Api\Accounts::id2name($user);
if (str_starts_with($path, $prefix)) $path = substr($path, strlen($prefix)); if (str_starts_with($path, $prefix)) $path = substr($path, strlen($prefix));
} }
header('Content-Type: application/json');
try { try {
if (str_starts_with($path, '/mail/attachments/')) if (str_starts_with($path, '/mail/attachments/'))
@ -91,7 +92,6 @@ class ApiHandler extends Api\CalDAV\Handler
} }
$push = new Api\Json\Push($user); $push = new Api\Json\Push($user);
$push->call('egw.open', '', 'mail', 'add', ['preset' => $preset], '_blank', 'mail'); $push->call('egw.open', '', 'mail', 'add', ['preset' => $preset], '_blank', 'mail');
header('Content-Type: application/json');
echo json_encode([ echo json_encode([
'status' => 200, 'status' => 200,
'message' => 'Request to open compose window sent', 'message' => 'Request to open compose window sent',
@ -121,7 +121,6 @@ class ApiHandler extends Api\CalDAV\Handler
]+$preset); ]+$preset);
if ($compose->send($preset, $acc_id)) if ($compose->send($preset, $acc_id))
{ {
header('Content-Type: application/json');
echo json_encode(array_filter([ echo json_encode(array_filter([
'status' => 200, 'status' => 200,
'warning' => $warning ?? null, 'warning' => $warning ?? null,
@ -252,7 +251,6 @@ class ApiHandler extends Api\CalDAV\Handler
{ {
if (isset($fp)) fclose($fp); if (isset($fp)) fclose($fp);
header('Location: '.($location = '/mail/attachments/'.substr(basename($attachment_path), 8))); header('Location: '.($location = '/mail/attachments/'.substr(basename($attachment_path), 8)));
header('Content-Type: application/json');
echo json_encode([ echo json_encode([
'status' => 200, 'status' => 200,
'message' => 'Attachment stored', 'message' => 'Attachment stored',