Response.text
Consume an HTTP response body.
js
response.text()Arguments
No arguments.
Returns
Promise<string> with the body.
Example
js
(async () => {
const response = await fetch("https://example.com");
console.log(await response.text());
})().catch(error => { console.error(error.message); throw error; });Notes
Use either text() or json() once; a second consumption rejects.