Skip to content

Commit 2df8c2d

Browse files
authored
fix(fetch): param stringification for Safari < 17.0 (#1918)
1 parent 04c5669 commit 2df8c2d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/fetch/src/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export const generateRequestFunction = (
7171
const explodeArrayImplementation =
7272
explodeParameters.length > 0
7373
? `const explodeParameters = ${JSON.stringify(explodeParametersNames)};
74-
74+
7575
if (value instanceof Array && explodeParameters.includes(key)) {
7676
value.forEach((v) => normalizedParams.append(key, v === null ? 'null' : v.toString()));
7777
return;
@@ -98,9 +98,11 @@ ${
9898
: ''
9999
}
100100
101+
${queryParams ? `const stringifiedParams = normalizedParams.toString();` : ``}
102+
101103
${
102104
queryParams
103-
? `return normalizedParams.size ? \`${route}${'?${normalizedParams.toString()}'}\` : \`${route}\``
105+
? `return stringifiedParams.length > 0 ? \`${route}${'?${stringifiedParams}'}\` : \`${route}\``
104106
: `return \`${route}\``
105107
}
106108
}\n`;
@@ -190,7 +192,7 @@ ${
190192
`;
191193
const fetchResponseImplementation = isNdJson
192194
? `const stream = await fetch(${fetchFnOptions})
193-
195+
194196
${override.fetch.includeHttpResponseReturnType ? 'return { status: stream.status, stream, headers: stream.headers }' : `return stream`}
195197
`
196198
: `const res = await fetch(${fetchFnOptions})

0 commit comments

Comments
 (0)