En el siguiente fragmento, la descarga funciona como se esperaba, pero la carga no funciona y se obtiene una respuesta HTTP 500 . El problema no es backend, ya que funciona en Postman o equivalente. ¿Cual podría ser el problema?
return fetch('url', { method: 'GET', }).then((response) => { //upload if (response.status === 200) { let blob = response.blob(); return fetch('url', { method: 'POST', headers: { 'Content-Type': 'application/octet-stream', }, body: blob, }).then((response) => { console.log(response.status); }); } });Intenta usar datos de formulario,
if (response.status === 200) { let blob = response.blob(); const formData = new FormData(); formData.set('file', blob); return fetch('url', { method: 'POST', headers: { 'Content-Type': 'multipart/form-data' }, body: blob, }).then((response) => { console.log(response.status); }); }