diff --git a/examples/fastify/zod/fetch.ts b/examples/fastify/zod/fetch.ts index 0a11079..36cca01 100644 --- a/examples/fastify/zod/fetch.ts +++ b/examples/fastify/zod/fetch.ts @@ -50,6 +50,10 @@ const main = async () => { const r = await res.json(); console.log(`${path}:${method} => ${r.userId}`); console.log(res.headers.get("Content-Type")); + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const contentType: "application/json" = res.headers.get("Content-Type"); + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const hasContentType: true = res.headers.has("Content-Type"); } else { // e is the response schema defined in pathMap["/users"]["post"].res other than "20X" const e = await res.text(); diff --git a/examples/spec/zod.ts b/examples/spec/zod.ts index 00a41fa..cf4265f 100644 --- a/examples/spec/zod.ts +++ b/examples/spec/zod.ts @@ -2,8 +2,8 @@ import { z } from "zod"; import { ToApiEndpoints, ZodApiEndpoints } from "../../src"; const JsonHeader = z.union([ - z.object({ "content-type": z.string() }), - z.object({ "Content-Type": z.string() }), + z.object({ "content-type": z.literal("application/json") }), + z.object({ "Content-Type": z.literal("application/json") }), ]); export const pathMap = { "/users": {