HTML:標記語言
CSS:樣式語言
JavaScript:指令碼語言
Web API:程式設計介面
所有 Web 技術
學習 Web 開發
發現我們的工具
更好地瞭解 MDN
此特性已得到良好確立,可跨多種裝置和瀏覽器版本使用。自 2017 年 3 月起,所有瀏覽器均支援此特性。
注意:此功能在 Web Workers 中可用。
Request 介面的 text() 方法讀取請求體並將其作為 Promise 返回,該 Promise 解析為 String。響應始終使用 UTF-8 進行解碼。
Request
text()
String
無。
一個解析為 String 的 Promise。
const text = "Hello world"; const request = new Request("/myEndpoint", { method: "POST", body: text, }); request.text().then((text) => { // do something with the text sent in the request });
載入中…
Response.text()