Skip to content

Commit cc623f6

Browse files
author
Capacitor+ Bot
committed
chore: sync upstream PR ionic-team#7301 from @jwltr
2 parents 4c7c126 + e13d7c2 commit cc623f6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

core/src/core-plugins.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,14 +419,20 @@ export class CapacitorHttpPluginWeb extends WebPlugin implements CapacitorHttpPl
419419

420420
let data: any;
421421
let blob: any;
422+
let responseText: string;
422423
switch (responseType) {
423424
case 'arraybuffer':
424425
case 'blob':
425426
blob = await response.blob();
426427
data = await readBlobAsBase64(blob);
427428
break;
428429
case 'json':
429-
data = await response.json();
430+
responseText = await response.text();
431+
try {
432+
data = JSON.parse(responseText);
433+
} catch (e) {
434+
data = responseText;
435+
}
430436
break;
431437
case 'document':
432438
case 'text':

0 commit comments

Comments
 (0)