serializeBody

Function

统一的请求体序列化逻辑(核心统一处理,不下放各适配器,避免出现细微不一致, 尤其影响文件上传场景)。 `FormData`/`Blob`/`ArrayBuffer`/`URLSearchParams`/`ReadableStream`/字符串原样传递, 不设置 `Content-Type: application/json`;其余情况使用 `JSON.stringify` 并设置该 header。

Signature

function serializeBody(data: unknown): SerializedBody

Parameters

NameTypeDescription
dataunknown

Returns

SerializedBody

Source

packages/http/src/core/serializeBody.ts:15