mirror of
https://github.com/honojs/hono.git
synced 2024-11-29 17:46:30 +01:00
fix(client): Web query undefined check (#1340)
* Added check for undefined in query * denofied
This commit is contained in:
parent
49ce537684
commit
fa1c7df42b
@ -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) {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user