mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
fetchWorker: log responses
This commit is contained in:
parent
576a66460f
commit
93874df063
1 changed files with 10 additions and 1 deletions
|
|
@ -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(),
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue