Implements tests for commit bfa7b190b2

Covers the four consumption lifecycle Web proxy endpoints with unit, integration and security tests and their DTO and request fixtures. Changes the report progress Web route from POST to PUT, matching the upstream API, and updates the music player and the book reader to send that verb.
This commit is contained in:
BinaryAlley committed 2026-10-28 12:55:55 +02:00
1 parent 1afb078efc
commit d3b4eec630
22 files changed
+3108 -5

No files matched your search

@@ -36,7 +36,7 @@ public class ReportConsumptionProgressEndpoint : BaseEndpoint<ReportConsumptionP
public override void Configure()
{
base.Configure();
Verbs(Http.POST);
Verbs(Http.PUT);
Routes(WebRoutes.MediaConsumption.REPORT_CONSUMPTION_PROGRESS);
DontAutoTag();
Options(options => options.WithTags("MediaConsumption"));
@@ -326,7 +326,8 @@
if (token && token.value)
headers['RequestVerificationToken'] = token.value;
const response = await fetch(url, {
method: 'POST',
// The progress route is a PUT, unlike the start, complete and stop routes of the same lifecycle.
method: options.method || 'POST',
headers: headers,
body: JSON.stringify(payload ?? {}),
signal: abortController === null ? undefined : abortController.signal,
@@ -478,7 +479,7 @@
const payload = session.pendingProgressPayload;
session.pendingProgressPayload = null;
const url = buildConsumptionRecordUrl(reportConsumptionProgressUrlTemplate, session.recordId);
await sendConsumptionRequestAsync(url, payload);
await sendConsumptionRequestAsync(url, payload, { method: 'PUT' });
}
} catch (error) {
console.debug('Book reader: a consumption progress report could not be sent.', error);