From https://javascript.info/promise-chaining :
let promise = fetch(url);
This makes a network request to the
url
and returns a promise. The promise resolves with aresponse
object when the remote server responds with headers, but before the full response is downloaded.
Just being curious, why separates response headers and body into 2 steps/promises? If I remember correctly, traditional XMLHttpRequest
does behave like this. Since the body always comes after header, does it make a difference to separate this complete process?