refactor: make POST /retry take a singular id

The endpoint accepted {ids: [x]} and then rejected anything but exactly one
id, so the schema advertised a batch it never supported. Retry is genuinely
singular: unlike the /delete, /start and /cancel batches, which act on local
state and can't meaningfully fail for one id and not another, each retry
re-extracts the URL and the caller removes that item's done record only once
it is confirmed re-queued. A real batch form would need per-id results in the
response for the caller to know which records to remove; that only becomes
worth designing alongside moving done-record deletion server-side.

/retry has not shipped yet, so there is no compatibility cost.
This commit is contained in:
Alex Shnitman
2026-07-27 21:19:01 +03:00
parent 1a09dbd686
commit ff1b73a576
4 changed files with 23 additions and 7 deletions
@@ -121,7 +121,7 @@ describe('DownloadsService', () => {
service.retry('https://example.com/v').subscribe();
const req = httpMock.expectOne('retry');
expect(req.request.method).toBe('POST');
expect(req.request.body).toEqual({ ids: ['https://example.com/v'] });
expect(req.request.body).toEqual({ id: 'https://example.com/v' });
req.flush({ status: 'ok' });
});
+1 -1
View File
@@ -170,7 +170,7 @@ export class DownloadsService {
}
public retry(id: string) {
return this.http.post<Status>('retry', { ids: [id] }).pipe(
return this.http.post<Status>('retry', { id: id }).pipe(
catchError(this.handleHTTPError)
);
}