@kubb/plugin-axios 5.5.5 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-axios",
3
- "version": "5.5.5",
3
+ "version": "5.5.7",
4
4
  "description": "Generate a slim, type-safe HTTP client with Kubb based on axios.",
5
5
  "keywords": [
6
6
  "api-client",
@@ -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
- transformRequest: (data) => data,
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,