diff --git a/src/lib/kaiware.ts b/src/lib/kaiware.ts index bdee68e..10d8723 100644 --- a/src/lib/kaiware.ts +++ b/src/lib/kaiware.ts @@ -230,7 +230,8 @@ export class Kaiware { lifecycleStatus: 'success', responseStatus: this.status, responseHeaders, - responseBody: this.responseText + responseBody: this.responseText, + responseSize: new Blob([this.responseText]).size }); }); diff --git a/src/types/schemas.ts b/src/types/schemas.ts index 873fc80..7739f9d 100644 --- a/src/types/schemas.ts +++ b/src/types/schemas.ts @@ -111,7 +111,7 @@ export type ClearLogsPayload = z.infer; export const clearLogsResPayloadSchema = z.null(); export type ClearLogsResPayload = z.infer; -// NetworkRequestUpdate +// NetworkRequest export const networkRequestSchema = z.object({ requestId: z.string(), url: z.string(), @@ -135,10 +135,12 @@ export const networkRequestSchema = z.object({ endTime: z.number().optional(), responseStatus: z.number().optional(), responseHeaders: z.array(z.object({ key: z.string(), value: z.string() })).optional(), - responseBody: z.string().optional() + responseBody: z.string().optional(), + responseSize: z.number().optional() }); export type NetworkRequest = z.infer; +// NetworkRequestUpdateResPayload export const networkRequestUpdateResPayload = z.object({ requestId: z.string(), url: z.string().optional(), @@ -166,7 +168,8 @@ export const networkRequestUpdateResPayload = z.object({ endTime: z.number().optional(), responseStatus: z.number().optional(), responseHeaders: z.array(z.object({ key: z.string(), value: z.string() })).optional(), - responseBody: z.string().optional() + responseBody: z.string().optional(), + responseSize: z.number().optional() }); export type NetworkRequestUpdateResPayload = z.infer;