diff --git a/deno_dist/client/client.ts b/deno_dist/client/client.ts index b448209b..4b99f0dd 100644 --- a/deno_dist/client/client.ts +++ b/deno_dist/client/client.ts @@ -2,7 +2,7 @@ import type { Hono } from '../hono.ts' import type { ValidationTargets } from '../types.ts' import type { UnionToIntersection } from '../utils/types.ts' import type { Callback, Client, ClientRequestOptions } from './types.ts' -import { replaceUrlParam, mergePath, removeIndexString, deepMerge } from './utils.ts' +import { deepMerge, mergePath, removeIndexString, replaceUrlParam } from './utils.ts' const createProxy = (callback: Callback, path: string[]) => { const proxy: unknown = new Proxy(() => {}, { @@ -41,6 +41,10 @@ class ClientRequestImpl { if (args) { if (args.query) { for (const [k, v] of Object.entries(args.query)) { + if (v === undefined) { + return + } + this.queryParams ||= new URLSearchParams() if (Array.isArray(v)) { for (const v2 of v) { diff --git a/src/client/client.ts b/src/client/client.ts index 3d7a9ec3..76a9d72c 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -2,7 +2,7 @@ import type { Hono } from '../hono' import type { ValidationTargets } from '../types' import type { UnionToIntersection } from '../utils/types' import type { Callback, Client, ClientRequestOptions } from './types' -import { replaceUrlParam, mergePath, removeIndexString, deepMerge } from './utils' +import { deepMerge, mergePath, removeIndexString, replaceUrlParam } from './utils' const createProxy = (callback: Callback, path: string[]) => { const proxy: unknown = new Proxy(() => {}, { @@ -41,6 +41,10 @@ class ClientRequestImpl { if (args) { if (args.query) { for (const [k, v] of Object.entries(args.query)) { + if (v === undefined) { + return + } + this.queryParams ||= new URLSearchParams() if (Array.isArray(v)) { for (const v2 of v) {