Skip to content

Commit c0189b0

Browse files
authored
Revert #2556 (#2584)
1 parent 7635787 commit c0189b0

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

packages/openapi-fetch/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ export function defaultPathSerializer(pathname, pathParams) {
597597
* @type {import("./index.js").defaultBodySerializer}
598598
*/
599599
export function defaultBodySerializer(body, headers) {
600-
if (body instanceof FormData || typeof body === "string" || body instanceof URLSearchParams || body instanceof Blob) {
600+
if (body instanceof FormData) {
601601
return body;
602602
}
603603
if (headers) {

packages/openapi-fetch/test/common/request.test.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,32 +213,30 @@ describe("request", () => {
213213
});
214214

215215
test.each(BODY_ACCEPTING_METHODS)("`''` body (with body serializer) - %s", async (method) => {
216-
const body = ''
217216
const bodySerializer = vi.fn((body) => `Serialized: ${JSON.stringify(body)}`);
218217
const { bodyUsed, bodyText } = await fireRequestAndGetBodyInformation({
219218
bodySerializer,
220219
method,
221220
fetchOptions: {
222-
body,
221+
body: "",
223222
},
224223
});
225224

226225
expect(bodyUsed).toBe(true);
227-
expect(bodyText).toBe(`Serialized: ${body}`);
226+
expect(bodyText).toBe('Serialized: ""');
228227
expect(bodySerializer).toBeCalled();
229228
});
230229

231230
test.each(BODY_ACCEPTING_METHODS)("`''` body (without body serializer) - %s", async (method) => {
232-
const body = ''
233231
const { bodyUsed, bodyText } = await fireRequestAndGetBodyInformation({
234232
method,
235233
fetchOptions: {
236-
body,
234+
body: "",
237235
},
238236
});
239237

240238
expect(bodyUsed).toBe(true);
241-
expect(bodyText).toBe(body);
239+
expect(bodyText).toBe('""');
242240
});
243241

244242
test.each(BODY_ACCEPTING_METHODS)("`0` body (with body serializer) - %s", async (method) => {

0 commit comments

Comments
 (0)