fix(#1995): send {} body on schedule cancel-all (was empty body 400)
This commit is contained in:
parent
eba637b36c
commit
09dc3682d7
1 changed files with 4 additions and 1 deletions
|
|
@ -1072,8 +1072,11 @@ async function postScheduleCancel(id, targets) {
|
||||||
const opts = {
|
const opts = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
// Always send a valid JSON body — cancel-all is `{}` (an empty body
|
||||||
|
// with a json content-type would 400 a strict extractor). Per-target
|
||||||
|
// cancel carries the list.
|
||||||
|
body: JSON.stringify(targets ? { targets } : {}),
|
||||||
};
|
};
|
||||||
if (targets) opts.body = JSON.stringify({ targets });
|
|
||||||
const resp = await fetch('/api/schedules/' + encodeURIComponent(id) + '/cancel', opts);
|
const resp = await fetch('/api/schedules/' + encodeURIComponent(id) + '/cancel', opts);
|
||||||
if (!resp.ok) {
|
if (!resp.ok) {
|
||||||
const text = await resp.text().catch(() => '');
|
const text = await resp.text().catch(() => '');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue