fetchWorker: log responses

This commit is contained in:
Alex Gleason 2025-02-09 14:50:28 -06:00
parent 576a66460f
commit 93874df063
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -13,10 +13,19 @@ export const FetchWorker = {
init: Omit<RequestInit, 'signal'>, init: Omit<RequestInit, 'signal'>,
signal: AbortSignal | null | undefined, signal: AbortSignal | null | undefined,
): Promise<[BodyInit, ResponseInit]> { ): Promise<[BodyInit, ResponseInit]> {
logi({ level: 'debug', ns: 'ditto.fetch', method: init.method ?? 'GET', url }); logi({ level: 'debug', ns: 'ditto.fetch', state: 'started', method: init.method ?? 'GET', url });
const response = await safeFetch(url, { ...init, signal }); const response = await safeFetch(url, { ...init, signal });
logi({
level: 'debug',
ns: 'ditto.fetch',
state: 'finished',
method: init.method ?? 'GET',
url,
status: response.status,
});
return [ return [
await response.arrayBuffer(), await response.arrayBuffer(),
{ {