-
Notifications
You must be signed in to change notification settings - Fork 26.6k
Closed
Labels
area: common/httpIssues related to HTTP and HTTP ClientIssues related to HTTP and HTTP Clientfreq1: lowneeds reproductionThis issue needs a reproduction in order for the team to investigate furtherThis issue needs a reproduction in order for the team to investigate furthertype: bug/fix
Milestone
Description
Affected Package
The issue is in the http client (@angular/common/http) request report progress featureDescription
In my Angular app, I uploads files to a Node.js web service.So I am using the HttpClient request method with reportProgress option on.
When I run the app in dev mode (ng build
), reportProgress works fine, but when run ng build --prod
reportProgress stops working.
Here is a sample from the angular service that uploads files
const formData: FormData = new FormData();
formData.append('file', file, file.name);
const req = new HttpRequest('POST', url, formData, { reportProgress: true });
const progress = new Subject<number>();
const sub = this.http.request<any>(req).subscribe(
event => {
if (event.type === HttpEventType.UploadProgress) {
const percentDone = Math.round(100 * event.loaded / event.total);
progress.next(percentDone);
} else if (event instanceof HttpResponse) {
progress.complete();
const datafiles = event.body.map(item => new Datafile(item));
callback(datafiles);
}
},
err => errCallback(err)
);
ericmartinezr
Metadata
Metadata
Assignees
Labels
area: common/httpIssues related to HTTP and HTTP ClientIssues related to HTTP and HTTP Clientfreq1: lowneeds reproductionThis issue needs a reproduction in order for the team to investigate furtherThis issue needs a reproduction in order for the team to investigate furthertype: bug/fix