Skip to content

Commit 0d9bc6b

Browse files
committed
fix: avoid falsy value wrongly filter out
1 parent c42c65c commit 0d9bc6b

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

  • packages/openapi-ts/src/plugins/@hey-api/client-ky/bundle

packages/openapi-ts/src/plugins/@hey-api/client-ky/bundle/client.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -127,21 +127,21 @@ export const createClient = (config: Config = {}): Client => {
127127

128128
const kyOptions: KyOptions = {
129129
body: validBody as BodyInit,
130-
...(opts.cache ? { cache: opts.cache } : {}),
131-
...(opts.credentials ? { credentials: opts.credentials } : {}),
132-
...(opts.headers ? { headers: opts.headers } : {}),
133-
...(opts.integrity ? { integrity: opts.integrity } : {}),
134-
...(opts.keepalive ? { keepalive: opts.keepalive } : {}),
135-
...(opts.method ? { method: opts.method } : {}),
136-
...(opts.mode ? { mode: opts.mode } : {}),
137-
redirect: opts.redirect || 'follow',
138-
...(opts.referrer ? { referrer: opts.referrer } : {}),
139-
...(opts.referrerPolicy ? { referrerPolicy: opts.referrerPolicy } : {}),
140-
...(opts.signal ? { signal: opts.signal } : {}),
130+
...(opts.cache !== undefined ? { cache: opts.cache } : {}),
131+
...(opts.credentials !== undefined ? { credentials: opts.credentials } : {}),
132+
...(opts.headers !== undefined ? { headers: opts.headers } : {}),
133+
...(opts.integrity !== undefined ? { integrity: opts.integrity } : {}),
134+
...(opts.keepalive !== undefined ? { keepalive: opts.keepalive } : {}),
135+
...(opts.method !== undefined ? { method: opts.method } : {}),
136+
...(opts.mode !== undefined ? { mode: opts.mode } : {}),
137+
redirect: opts.redirect ?? 'follow',
138+
...(opts.referrer !== undefined ? { referrer: opts.referrer } : {}),
139+
...(opts.referrerPolicy !== undefined ? { referrerPolicy: opts.referrerPolicy } : {}),
140+
...(opts.signal !== undefined ? { signal: opts.signal } : {}),
141141
throwHttpErrors: opts.throwOnError ?? false,
142-
...(opts.timeout ? { timeout: opts.timeout } : {}),
143-
retry: opts.retry ?? 2,
142+
...(opts.timeout !== undefined ? { timeout: opts.timeout } : {}),
144143
...opts.kyOptions,
144+
retry: opts.retry ?? opts.kyOptions?.retry ?? 2,
145145
};
146146

147147
let request = new Request(url, {

0 commit comments

Comments
 (0)