From 7f8900a1de9addeb0d371103a2c5c2aa3e4ff95e Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 1 Jul 2024 22:00:50 +1200 Subject: [PATCH] support undefined in http request schema apis (#3136) Co-authored-by: Tim Smart --- .changeset/forty-crabs-turn.md | 5 +++++ packages/platform/src/HttpIncomingMessage.ts | 6 +++--- packages/platform/src/HttpServerRequest.ts | 6 +++--- packages/platform/src/internal/httpServerRequest.ts | 6 +++--- 4 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 .changeset/forty-crabs-turn.md diff --git a/.changeset/forty-crabs-turn.md b/.changeset/forty-crabs-turn.md new file mode 100644 index 0000000000..41292cc09e --- /dev/null +++ b/.changeset/forty-crabs-turn.md @@ -0,0 +1,5 @@ +--- +"@effect/platform": patch +--- + +support undefined in http request schema apis diff --git a/packages/platform/src/HttpIncomingMessage.ts b/packages/platform/src/HttpIncomingMessage.ts index de8c43ce6e..29f616c5b5 100644 --- a/packages/platform/src/HttpIncomingMessage.ts +++ b/packages/platform/src/HttpIncomingMessage.ts @@ -69,7 +69,7 @@ export const schemaBodyJsonScoped = (schema: Schema.Schema, op * @since 1.0.0 * @category schema */ -export const schemaBodyUrlParams = >, R>( +export const schemaBodyUrlParams = >, R>( schema: Schema.Schema, options?: ParseOptions | undefined ) => { @@ -82,7 +82,7 @@ export const schemaBodyUrlParams = * @since 1.0.0 * @category schema */ -export const schemaBodyUrlParamsScoped = >, R>( +export const schemaBodyUrlParamsScoped = >, R>( schema: Schema.Schema, options?: ParseOptions | undefined ) => { @@ -109,7 +109,7 @@ export const schemaHeaders = >, R>( +export const schemaHeadersScoped = >, R>( schema: Schema.Schema, options?: ParseOptions | undefined ) => { diff --git a/packages/platform/src/HttpServerRequest.ts b/packages/platform/src/HttpServerRequest.ts index e6554bb91c..f1495005ce 100644 --- a/packages/platform/src/HttpServerRequest.ts +++ b/packages/platform/src/HttpServerRequest.ts @@ -134,7 +134,7 @@ export const upgradeChannel: () => Channel< * @since 1.0.0 * @category schema */ -export const schemaCookies: >, R>( +export const schemaCookies: >, R>( schema: Schema.Schema, options?: ParseOptions | undefined ) => Effect.Effect = internal.schemaCookies @@ -143,7 +143,7 @@ export const schemaCookies: >, R>( * @since 1.0.0 * @category schema */ -export const schemaHeaders: >, R>( +export const schemaHeaders: >, R>( schema: Schema.Schema, options?: ParseOptions | undefined ) => Effect.Effect = internal.schemaHeaders @@ -183,7 +183,7 @@ export const schemaBodyForm: , R>( * @since 1.0.0 * @category schema */ -export const schemaBodyUrlParams: >, R>( +export const schemaBodyUrlParams: >, R>( schema: Schema.Schema, options?: ParseOptions | undefined ) => Effect.Effect = internal.schemaBodyUrlParams diff --git a/packages/platform/src/internal/httpServerRequest.ts b/packages/platform/src/internal/httpServerRequest.ts index 56e77b1cdf..b41193bddb 100644 --- a/packages/platform/src/internal/httpServerRequest.ts +++ b/packages/platform/src/internal/httpServerRequest.ts @@ -63,7 +63,7 @@ export const searchParamsFromURL = (url: URL): ReadonlyRecord>, R>( +export const schemaCookies = >, R>( schema: Schema.Schema, options?: ParseOptions | undefined ) => { @@ -72,7 +72,7 @@ export const schemaCookies = >, R>( } /** @internal */ -export const schemaHeaders = >, R>( +export const schemaHeaders = >, R>( schema: Schema.Schema, options?: ParseOptions | undefined ) => { @@ -118,7 +118,7 @@ export const schemaBodyForm = , R>( } /** @internal */ -export const schemaBodyUrlParams = >, R>( +export const schemaBodyUrlParams = >, R>( schema: Schema.Schema, options?: ParseOptions | undefined ) => {