You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: packages/@uppy/xhr-upload/src/index.ts
+12-7
Original file line number
Diff line number
Diff line change
@@ -235,13 +235,18 @@ export default class XHRUpload<
235
235
})
236
236
237
237
letbody=awaitthis.opts.getResponseData?.(res)
238
-
try{
239
-
body??=JSON.parse(res.responseText)asB
240
-
}catch(cause){
241
-
thrownewError(
242
-
'@uppy/xhr-upload expects a JSON response (with a `url` property). To parse non-JSON responses, use `getResponseData` to turn your response into JSON.',
243
-
{ cause },
244
-
)
238
+
239
+
if(res.responseType==='json'){
240
+
body??=res.response
241
+
}else{
242
+
try{
243
+
body??=JSON.parse(res.responseText)asB
244
+
}catch(cause){
245
+
thrownewError(
246
+
'@uppy/xhr-upload expects a JSON response (with a `url` property). To parse non-JSON responses, use `getResponseData` to turn your response into JSON.',
0 commit comments