Response.prototype.text

Returns a promise that resolves to the response as a string.

Syntax

text()

Return value

A promise that resolves to a string.

Examples

fetch('https://www.rfc-editor.org/rfc/rfc2616.txt')
  .then(r => r.text())
  .then(s => print(x.split('\n')[23].trim()))
Hypertext Transfer Protocol -- HTTP/1.1