deal with empty strings for proxyId

This commit is contained in:
Alex Holliday committed 2026-08-26 11:19:08 -07:00
1 parent c24440f8c9
commit f30085bae3
7 files changed
+133 -23

No files matched your search

+6 -1
View File
@@ -69,7 +69,12 @@ const httpSchema = baseSchema.extend({
type: z.literal("http"),
url: urlSchema,
proxyMode: z.enum(ProxyModes),
proxyId: z.string().optional(),
// The form uses "" for "no proxy selected". drop it from the payload so the
// server never receives an empty ObjectId
proxyId: z
.string()
.transform((value) => (value === "" ? undefined : value))
.optional(),
method: z.enum(HttpMethods).optional().register(monitorStepRegistry, { step: 2 }),
ignoreTlsErrors: z.boolean().register(monitorStepRegistry, { step: 2 }),
useAdvancedMatching: z.boolean().register(monitorStepRegistry, { step: 2 }),