@kubb/plugin-axios 5.5.6 → 5.5.7
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 +1 -1
- package/templates/axios.ts +4 -1
package/package.json
CHANGED
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,
|