Suppose if I want to get a JSON data from a HTTP GET request using observable:
this.getJSON().subscribe(response => {
for (let item of response) {
// ... iterate array
}
});
My question is about how the response is received and handled by observable.
The response data has an Array of say, 1000 elements. Does the HTTP request return JSON data in chunks? say, 100 arrays, then 400 arrays, and then 1000 arrays? Or, before the .subscribe method is called all 1000 array must be fetched?
So, if it is received in chunks then it means the .subscribe method will be called over and over. In my case according to what I tested, it waits until all 1000 array items are fetched before calling subscribe.
I am trying to understand if that's the normal behavior or not.
Transfer-Encoding: chunked
header. It all boils down to how your HTTP endpoint works, and how angular works.