我看到MDN/Response/text.text()文档上显示了仅使用的示例then
response.text().then(function (text) {
// do something with the text response
});
Run Code Online (Sandbox Code Playgroud)
它返回一个用字符串解析的承诺。
由于 lint 规则,我需要放置
// eslint-disable-next-line @typescript-eslint/no-floating-promises
res.text().then(async (t) => {
Run Code Online (Sandbox Code Playgroud)
当我需要捕获被拒绝的承诺时,是否有用例Response.text()?也许一些例子?