code: function (event) {
                  // Send the HttpResponseHeaders event if it hasn't been sent already.
                  if (!sentHeaders) {
                      observer.next(partialFromXhr());
                      sentHeaders = true;
                  }
                  // Start building the download progress event to deliver on the response
                  // event stream.
                  var progressEvent = {
                      type: HttpEventType.DownloadProgress,
                      loaded: event.loaded,
                  };
                  // Set the total number of bytes in the event if it's available.
                  if (event.lengthComputable) {
                      progressEvent.total = event.total;
                  }
                  // If the request was for text content and a partial response is
                  // available on XMLHttpRequest, include it in the progress event
                  // to allow for streaming reads.
                  if (req.responseType === 'text' && !!xhr.responseText) {
                      progressEvent.partialText = xhr.responseText;
                  }
                  // Finally, fire the event.
                  observer.next(progressEvent);
              }
docs: The download progress event handler, which is only registered if progress events are enabled.