@kubb/plugin-fetch 5.4.1 → 5.5.0-canary.20260910T215210
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/templates/fetch.ts +7 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-fetch",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0-canary.20260910T215210",
|
|
4
4
|
"description": "Generate a slim, type-safe HTTP client with Kubb based on the native Fetch api.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api-client",
|
|
@@ -65,12 +65,12 @@
|
|
|
65
65
|
"registry": "https://registry.npmjs.org/"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@kubb/plugin-ts": "^5.0.
|
|
69
|
-
"@kubb/plugin-zod": "^5.
|
|
68
|
+
"@kubb/plugin-ts": "^5.1.0-canary.20260910T215209",
|
|
69
|
+
"@kubb/plugin-zod": "^5.2.0-canary.20260910T215209"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@internals/client": "0.0.
|
|
73
|
-
"@internals/shared": "0.0.
|
|
72
|
+
"@internals/client": "0.1.0-canary.20260910T215209",
|
|
73
|
+
"@internals/shared": "0.1.0-canary.20260910T215209",
|
|
74
74
|
"kubb": "^5.2.0",
|
|
75
75
|
"typescript": "^6.0.3"
|
|
76
76
|
},
|
package/templates/fetch.ts
CHANGED
|
@@ -221,12 +221,12 @@ export type RequestConfig<TBody = unknown, TRequest = Request, TResponse = Respo
|
|
|
221
221
|
baseURL?: string
|
|
222
222
|
url?: string
|
|
223
223
|
method?: 'GET' | 'PUT' | 'PATCH' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD'
|
|
224
|
-
path?: unknown
|
|
224
|
+
path?: Record<string, unknown>
|
|
225
225
|
query?: unknown
|
|
226
226
|
params?: unknown
|
|
227
|
-
cookies?: unknown
|
|
227
|
+
cookies?: Record<string, unknown>
|
|
228
228
|
body?: TBody
|
|
229
|
-
headers?:
|
|
229
|
+
headers?: HeadersInit
|
|
230
230
|
styles?: Styles
|
|
231
231
|
signal?: AbortSignal
|
|
232
232
|
credentials?: RequestCredentials
|
|
@@ -558,7 +558,7 @@ async function resolveRequest<TBody, TRequest, TResponse>({
|
|
|
558
558
|
const { querySerializer, bodySerializer, pathSerializer } = resolveSerializers({ config, requestConfig })
|
|
559
559
|
const codecs = { ...config.codecs, ...requestConfig.codecs }
|
|
560
560
|
|
|
561
|
-
const headers = mergeHeaders(config.headers, applyHeaderStyles(requestConfig.headers
|
|
561
|
+
const headers = mergeHeaders(config.headers, applyHeaderStyles(requestConfig.headers, requestConfig.styles?.header))
|
|
562
562
|
const { request: requestContentTypeOption, response: responseContentType } = resolveContentType(requestConfig.contentType)
|
|
563
563
|
const requestContentType = requestContentTypeOption ?? getHeader(headers, 'content-type')
|
|
564
564
|
if (responseContentType && !hasHeader(headers, 'accept')) {
|
|
@@ -575,7 +575,7 @@ async function resolveRequest<TBody, TRequest, TResponse>({
|
|
|
575
575
|
})
|
|
576
576
|
|
|
577
577
|
if (requestConfig.cookies) {
|
|
578
|
-
const cookie = serializeCookies(requestConfig.cookies
|
|
578
|
+
const cookie = serializeCookies(requestConfig.cookies, requestConfig.styles?.cookie)
|
|
579
579
|
if (cookie) headers['Cookie'] = [headers['Cookie'], cookie].filter(Boolean).join('; ')
|
|
580
580
|
}
|
|
581
581
|
|
|
@@ -604,7 +604,7 @@ async function resolveRequest<TBody, TRequest, TResponse>({
|
|
|
604
604
|
|
|
605
605
|
const url = serializeUrl({
|
|
606
606
|
parts: [requestConfig.baseURL ?? config.baseURL, requestConfig.url],
|
|
607
|
-
pathParams:
|
|
607
|
+
pathParams: requestConfig.path ?? {},
|
|
608
608
|
search: querySerializer(query, requestConfig.styles?.query),
|
|
609
609
|
pathSerializer,
|
|
610
610
|
pathStyles: requestConfig.styles?.path,
|
|
@@ -733,7 +733,7 @@ export function createClientCore<TRequest = Request, TResponse = Response>(
|
|
|
733
733
|
const query: Record<string, unknown> = { ...((requestConfig.query ?? requestConfig.params) as Record<string, unknown> | undefined) }
|
|
734
734
|
return serializeUrl({
|
|
735
735
|
parts: [requestConfig.baseURL ?? config.baseURL, requestConfig.url],
|
|
736
|
-
pathParams:
|
|
736
|
+
pathParams: requestConfig.path ?? {},
|
|
737
737
|
search: querySerializer(query, requestConfig.styles?.query),
|
|
738
738
|
pathSerializer,
|
|
739
739
|
pathStyles: requestConfig.styles?.path,
|