@kubb/plugin-axios 5.5.6 → 5.5.8
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/dist/index.d.ts +2 -1
- package/package.json +6 -9
- package/templates/axios.ts +4 -1
package/dist/index.d.ts
CHANGED
|
@@ -74,7 +74,8 @@ type Options = OutputOptions & {
|
|
|
74
74
|
*/
|
|
75
75
|
override?: Array<Override<Omit<ResolvedOptions, 'throwOnErrorDefault'>>>;
|
|
76
76
|
/**
|
|
77
|
-
* Base URL prepended to every request. When omitted,
|
|
77
|
+
* Base URL prepended to every request. When omitted, the generated client sets no base URL, so
|
|
78
|
+
* set one at runtime with `client.setConfig({ baseURL })`. The adapter's server URL is not used.
|
|
78
79
|
* Values containing a `${...}` interpolation are emitted as template literals in the generated
|
|
79
80
|
* client config, which keeps runtime environment reads dynamic.
|
|
80
81
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-axios",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.8",
|
|
4
4
|
"description": "Generate a slim, type-safe HTTP client with Kubb based on axios.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api-client",
|
|
@@ -65,19 +65,19 @@
|
|
|
65
65
|
"registry": "https://registry.npmjs.org/"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@kubb/plugin-ts": "^5.0.
|
|
69
|
-
"@kubb/plugin-zod": "^5.4.
|
|
68
|
+
"@kubb/plugin-ts": "^5.0.6",
|
|
69
|
+
"@kubb/plugin-zod": "^5.4.4"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@internals/client": "0.0.0",
|
|
73
73
|
"@internals/shared": "0.0.0",
|
|
74
74
|
"axios": "^1.20.0",
|
|
75
|
-
"kubb": "^5.
|
|
75
|
+
"kubb": "^5.6.3",
|
|
76
76
|
"typescript": "^6.0.3"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"axios": "^1.20.0",
|
|
80
|
-
"kubb": "^5.
|
|
80
|
+
"kubb": "^5.6.3"
|
|
81
81
|
},
|
|
82
82
|
"peerDependenciesMeta": {
|
|
83
83
|
"axios": {
|
|
@@ -90,10 +90,7 @@
|
|
|
90
90
|
"scripts": {
|
|
91
91
|
"build": "tsdown",
|
|
92
92
|
"clean": "node -e \"require('node:fs').rmSync('./dist', {recursive:true,force:true})\"",
|
|
93
|
-
"lint": "oxlint .",
|
|
94
|
-
"lint:fix": "oxlint --fix .",
|
|
95
93
|
"start": "tsdown --watch",
|
|
96
|
-
"
|
|
97
|
-
"typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false"
|
|
94
|
+
"typecheck": "tsc"
|
|
98
95
|
}
|
|
99
96
|
}
|
package/templates/axios.ts
CHANGED
|
@@ -626,6 +626,8 @@ async function resolveRequest<TBody, TRequest, TResponse>({
|
|
|
626
626
|
}
|
|
627
627
|
} else if (requestContentTypeOption) {
|
|
628
628
|
headers['Content-Type'] = requestContentTypeOption
|
|
629
|
+
} else if (body instanceof URLSearchParams && !hasHeader(headers, 'content-type')) {
|
|
630
|
+
headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
|
629
631
|
} else if (usesDefaultBodySerializer && isDefaultJsonBody(validatedBody) && !hasHeader(headers, 'content-type')) {
|
|
630
632
|
headers['Content-Type'] = 'application/json'
|
|
631
633
|
}
|
|
@@ -650,7 +652,8 @@ async function resolveRequest<TBody, TRequest, TResponse>({
|
|
|
650
652
|
params: query,
|
|
651
653
|
paramsSerializer: (params) => querySerializer(params as Record<string, unknown>, requestConfig.styles?.query),
|
|
652
654
|
data: body,
|
|
653
|
-
|
|
655
|
+
// Kubb already serialized the body; only URLSearchParams needs a string, since axios's Node adapter rejects it.
|
|
656
|
+
transformRequest: (data) => (data instanceof URLSearchParams ? data.toString() : data),
|
|
654
657
|
signal: requestConfig.signal,
|
|
655
658
|
responseType: requestConfig.responseType,
|
|
656
659
|
validateStatus,
|