We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
return this.http.get(this.formatUrl(url), { headers: httpOptions.headers, params: httpOptions.params, responseType: 'blob', observe: 'response' }).pipe( map((response: HttpResponse<Blob>) => { // header looks like --> Content-Disposition: attachment; filename="filename.extn" if (response.headers.has(ContentDispositionHeaderName)) { // select value filename="filename.extn" --- *THIS CODE IS NEVER HIT* const fileNameValue = response.headers.getAll(ContentDispositionHeaderName).filter(x => x.startsWith('filename='))[0]; if (fileNameValue) { // extract value --> filename.extn const fileName = fileNameValue.split('=').map(x => x.replace('"', ''))[1]; if (fileName) { return new File([response.body], fileName); } } } return response.body; }) );
Angular Version:
Angular CLI: 9.1.4 Node: 12.18.1 OS: win32 x64 Angular: 9.1.4 ... animations, cli, common, compiler, compiler-cli, core, forms ... language-service, platform-browser, platform-browser-dynamic ... router Ivy Workspace: Yes Package Version ------------------------------------------------------------ @angular-devkit/architect 0.901.4 @angular-devkit/build-angular 0.901.4 @angular-devkit/build-ng-packagr 0.901.4 @angular-devkit/build-optimizer 0.901.4 @angular-devkit/build-webpack 0.901.4 @angular-devkit/core 9.1.4 @angular-devkit/schematics 9.1.4 @ngtools/webpack 9.1.4 @schematics/angular 9.1.4 @schematics/update 0.901.4 ng-packagr 9.1.2 rxjs 6.5.5 typescript 3.8.3 webpack 4.42.0
Anything else relevant?
The text was updated successfully, but these errors were encountered:
This has nothing to do with Angular but rather with how browsers expose headers. See https://stackoverflow.com/questions/45892875/unable-to-view-content-disposition-headers-in-angular4-get-response and many other similar questions
Sorry, something went wrong.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
No branches or pull requests
馃悶 bug report
Affected Package
The issue is caused by package @angular/common/httpIs this a regression?
Not sureDescription
Content-Disposition header is not returned by response.headers even when server sends it.馃敩 Minimal Reproduction
馃敟 Exception or Error
馃實 Your Environment
Angular Version:
Anything else relevant?
The text was updated successfully, but these errors were encountered: