diff --git a/core/src/core-plugins.ts b/core/src/core-plugins.ts index 7ec429f7c5..099db3916a 100644 --- a/core/src/core-plugins.ts +++ b/core/src/core-plugins.ts @@ -385,19 +385,23 @@ export class CapacitorHttpPluginWeb let data: any; let blob: any; - switch (responseType) { - case 'arraybuffer': - case 'blob': - blob = await response.blob(); - data = await readBlobAsBase64(blob); - break; - case 'json': - data = await response.json(); - break; - case 'document': - case 'text': - default: - data = await response.text(); + if (response.status === 204) { + data = null; + } else { + switch (responseType) { + case 'arraybuffer': + case 'blob': + blob = await response.blob(); + data = await readBlobAsBase64(blob); + break; + case 'json': + data = await response.json(); + break; + case 'document': + case 'text': + default: + data = await response.text(); + } } // Convert fetch headers to Capacitor HttpHeaders