add method to validation
This commit is contained in:
1 parent
8afd67a06d
commit
d84fc7e299
1 file changed
+7
-1
@@ -1,7 +1,12 @@
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import type { FieldPath } from "react-hook-form";
|
import type { FieldPath } from "react-hook-form";
|
||||||
import { GeoContinents } from "@/Types/GeoCheck";
|
import { GeoContinents } from "@/Types/GeoCheck";
|
||||||
import { DnsRecordTypes, PageSpeedStrategies, type MonitorType } from "@/Types/Monitor";
|
import {
|
||||||
|
DnsRecordTypes,
|
||||||
|
HttpMethods,
|
||||||
|
PageSpeedStrategies,
|
||||||
|
type MonitorType,
|
||||||
|
} from "@/Types/Monitor";
|
||||||
import { ALL_HTTP_STATUS_CODES } from "@/Utils/statusCode";
|
import { ALL_HTTP_STATUS_CODES } from "@/Utils/statusCode";
|
||||||
|
|
||||||
// Wizard step a field is validated on. Attached inline to each field below so
|
// Wizard step a field is validated on. Attached inline to each field below so
|
||||||
@@ -62,6 +67,7 @@ const httpStatusCode = z.number().refine((code) => httpStatusCodeSet.has(code),
|
|||||||
const httpSchema = baseSchema.extend({
|
const httpSchema = baseSchema.extend({
|
||||||
type: z.literal("http"),
|
type: z.literal("http"),
|
||||||
url: urlSchema,
|
url: urlSchema,
|
||||||
|
method: z.enum(HttpMethods).optional().register(monitorStepRegistry, { step: 2 }),
|
||||||
ignoreTlsErrors: z.boolean().register(monitorStepRegistry, { step: 2 }),
|
ignoreTlsErrors: z.boolean().register(monitorStepRegistry, { step: 2 }),
|
||||||
useAdvancedMatching: z.boolean().register(monitorStepRegistry, { step: 2 }),
|
useAdvancedMatching: z.boolean().register(monitorStepRegistry, { step: 2 }),
|
||||||
matchMethod: z
|
matchMethod: z
|
||||||
|
|||||||
Reference in new issue
Block a user