@hey-api/openapi-ts 0.90.2 → 0.90.4
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/dist/clients/fetch/client.ts +7 -1
- package/dist/clients/ky/client.ts +7 -1
- package/dist/clients/next/client.ts +7 -1
- package/dist/{config-BzR0jtGH.d.mts → config-BY6SQ9vq.d.mts} +333 -147
- package/dist/{config-84ipCnU3.d.cts → config-BpoUoSpn.d.cts} +333 -147
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/internal.cjs +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.mts +1 -1
- package/dist/internal.mjs +1 -1
- package/dist/{openApi-BwUPqtP_.cjs → openApi-3_A4QzK7.cjs} +451 -163
- package/dist/openApi-3_A4QzK7.cjs.map +1 -0
- package/dist/{openApi-PX3rDrOF.mjs → openApi-D6jppAcA.mjs} +451 -163
- package/dist/openApi-D6jppAcA.mjs.map +1 -0
- package/dist/run.cjs +3 -3
- package/dist/run.mjs +3 -3
- package/dist/{src-BCi83sdM.mjs → src-CGmZM4HZ.mjs} +4 -4
- package/dist/src-CGmZM4HZ.mjs.map +1 -0
- package/dist/{src-hU76ergi.cjs → src-CsHLuAJv.cjs} +4 -4
- package/dist/src-CsHLuAJv.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/openApi-BwUPqtP_.cjs.map +0 -1
- package/dist/openApi-PX3rDrOF.mjs.map +0 -1
- package/dist/src-BCi83sdM.mjs.map +0 -1
- package/dist/src-hU76ergi.cjs.map +0 -1
|
@@ -180,10 +180,16 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
180
180
|
case 'arrayBuffer':
|
|
181
181
|
case 'blob':
|
|
182
182
|
case 'formData':
|
|
183
|
-
case 'json':
|
|
184
183
|
case 'text':
|
|
185
184
|
data = await response[parseAs]();
|
|
186
185
|
break;
|
|
186
|
+
case 'json': {
|
|
187
|
+
// Some servers return 200 with no Content-Length and empty body.
|
|
188
|
+
// response.json() would throw; read as text and parse if non-empty.
|
|
189
|
+
const text = await response.text();
|
|
190
|
+
data = text ? JSON.parse(text) : {};
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
187
193
|
case 'stream':
|
|
188
194
|
return opts.responseStyle === 'data'
|
|
189
195
|
? response.body
|
|
@@ -249,10 +249,16 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
249
249
|
case 'arrayBuffer':
|
|
250
250
|
case 'blob':
|
|
251
251
|
case 'formData':
|
|
252
|
-
case 'json':
|
|
253
252
|
case 'text':
|
|
254
253
|
data = await response[parseAs]();
|
|
255
254
|
break;
|
|
255
|
+
case 'json': {
|
|
256
|
+
// Some servers return 200 with no Content-Length and empty body.
|
|
257
|
+
// response.json() would throw; read as text and parse if non-empty.
|
|
258
|
+
const text = await response.text();
|
|
259
|
+
data = text ? JSON.parse(text) : {};
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
256
262
|
case 'stream':
|
|
257
263
|
return opts.responseStyle === 'data'
|
|
258
264
|
? response.body
|
|
@@ -142,10 +142,16 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
142
142
|
case 'arrayBuffer':
|
|
143
143
|
case 'blob':
|
|
144
144
|
case 'formData':
|
|
145
|
-
case 'json':
|
|
146
145
|
case 'text':
|
|
147
146
|
data = await response[parseAs]();
|
|
148
147
|
break;
|
|
148
|
+
case 'json': {
|
|
149
|
+
// Some servers return 200 with no Content-Length and empty body.
|
|
150
|
+
// response.json() would throw; read as text and parse if non-empty.
|
|
151
|
+
const text = await response.text();
|
|
152
|
+
data = text ? JSON.parse(text) : {};
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
149
155
|
case 'stream':
|
|
150
156
|
return {
|
|
151
157
|
data: response.body,
|