Add HTTP event view

This commit is contained in:
Fang-Pen Lin
2025-12-05 12:07:43 -08:00
parent 5b97f5ae10
commit b98e9e7599
4 changed files with 170 additions and 6 deletions
@@ -30,16 +30,14 @@ export const HttpBaseEventSchema = z.object({
export const HttpRequestEventSchema = HttpBaseEventSchema.extend({
eventType: z.literal(HttpEventTypeSchema.Values.request),
method: z.string(),
url: z.string(),
url: z.string()
// TODO: optional for now
body: z.string().optional()
});
export const HttpResponseEventSchema = HttpBaseEventSchema.extend({
eventType: z.literal(HttpEventTypeSchema.Values.response),
status: z.string(),
status: z.string()
// TODO: optional for now
body: z.string().optional()
});
export const HttpEventSchema = z.discriminatedUnion("eventType", [HttpRequestEventSchema, HttpResponseEventSchema]);