Express Nodejs アプリから を使用してエラー メッセージを送信するres.status(400).send(err.stack);
と、受信側でセットアップしたデコーダー ストリームから抜け出せないようです。
これがブラウザの私のコードです(そのfetch
部分に限定されています):
fetch("/the/url", {
method: "POST",
body: formData,
}).then(response => {
if (response.status === 200) {
return response.blob().then((data) => {
return data;
});
} else {
return new Promise((resolve, reject) => {
let err_message = "";
let reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
reader.read().then(({done, value}) => {
// When no more data needs to be consumed, close the stream
if (done) {
reject(err_message);
return;
}
// Enqueue the next data chunk into our target stream
err_message += value;
});
}).then((res) => {
return (res)
}).catch((err) => {
return (err)
});
}
}).then((res) => {
console.log(res)
}).catch((err) => {
console.log(err)
});
then
後続のすべてにブレークポイントを設定しましcatch
たが、解決/拒否されません。
ポインタに感謝します。